package org.mybatis.generator.api.plus;

import org.mybatis.generator.api.IntrospectedColumn;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType;

import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @author wangfupeng
 */
public class MybatisUtilHtmlBack {

    public static String newImageSrc = "";

    public static String configImageSrc = "";

    public static String searchImageSrc = "";

    public static String deleteImageSrc = "";

    public static String noImageSrc = "";

    public static String yesImageSrc = "";

    public static String editImageSrc = "";

    public static String loadingImageSrc = "";

    public static String plusImageSrc = "";

    public static String minusImageSrc = "";

    public static void writeIndexPage(IntrospectedTable introspectedTable, String htmlPath, String modelUrl) {
        File file = null;
        OutputStream fileOutputStream = null;
        BufferedWriter bufferedWriter = null;
        try {
            File folder = new File(htmlPath + "");
            folder.mkdirs();
            file = new File(htmlPath + "/index.html");
            //如果文件不存在，则创建文件
            file.createNewFile();
            fileOutputStream = new FileOutputStream(file);
            bufferedWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream, "utf-8"));
            bufferedWriter.write("<!DOCTYPE html>\n");
            bufferedWriter.write("<html lang=\"zh-CN\">\n");
            bufferedWriter.write("<head>\n");
            bufferedWriter.write("<meta charset=\"UTF-8\">\n");
            bufferedWriter.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n");
            bufferedWriter.write("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\">\n");
            bufferedWriter.write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no\">\n");
            bufferedWriter.write("<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\">\n");
            bufferedWriter.write("<meta name=\"referrer\" content=\"always\">\n");
            bufferedWriter.write("<meta http-equiv=\"Cache-Control\" content=\"max-age=31536000\" />\n");
            bufferedWriter.write("<title>后台管理</title>\n");
            bufferedWriter.write("<script>\n");
            bufferedWriter.write("if(localStorage.getItem('token')==undefined){\n" +
                    "location.href='login.html';\n" +
                    "}\n");
            bufferedWriter.write("</script>\n");
            bufferedWriter.write("<style>.navigate:hover{background-color:#661666;cursor:pointer;color:white;}.navigate{color:#666666;}</style></head>\n");
            bufferedWriter.write("<body>\n");
            bufferedWriter.write("<header class=\"class_header\" style=\"padding-bottom: 6px;\">\n");
            bufferedWriter.write("</header>\n");
            bufferedWriter.write("<aside style=\"width: 20%; height:666px; overflow-y:scroll;float: left;font-size: 12px;\" class=\"class_aside\">\n");
            bufferedWriter.write("</aside>\n");
            bufferedWriter.write("<section style=\"width:80%;height:666px; float:left;\" class=\"class_section\">\n");
            bufferedWriter.write("<iframe  style=\"width:100%;height:666px; float:left;\" class='class_section_iframe' src='blank.html' ></iframe>\n");
            bufferedWriter.write("</section>\n");
            bufferedWriter.write("<script src=\"js/common/jquery.js\" type=\"text/javascript\"></script>\n");
            bufferedWriter.write("<script src=\"js/common/server.js\" type=\"text/javascript\"></script>\n");
            bufferedWriter.write("<script>\n");
            bufferedWriter.write("$(function(){\n" +
                    "$('.class_aside').load('leftFramePage.html');\n" +
                    "$('.class_header').load('top.html');\n" +
                    "$.getScript(\"js/common/custom.js\");\n" +
                    "})\n");
            bufferedWriter.write("\n");
            bufferedWriter.write("</script>\n");
            bufferedWriter.write("</body>\n");
            bufferedWriter.write("</html>\n");
            System.out.println("write to file success : "+file.getPath());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (bufferedWriter != null) {
                    bufferedWriter.flush();
                    bufferedWriter.close();
                }
                if (fileOutputStream != null) {
                    fileOutputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void writeLeftFramePage(IntrospectedTable introspectedTable, String htmlPath, String modelUrl) {
        File file = null;
        OutputStream fileOutputStream = null;
        BufferedWriter bufferedWriter = null;
        String table = introspectedTable.getBaseRecordType();
        String tableName = table.replaceAll(modelUrl + ".", "");
        try {
            File folder = new File(htmlPath + "");
            folder.mkdirs();
            file = new File(htmlPath + "/leftFramePage.html");
            //判断文件里有没有内容已经写过。
            if (file.canRead()) {
                BufferedReader reader = null;
                Boolean alreadyHasThisContent = false;
                try {
                    reader = new BufferedReader(new FileReader(file));
                    String tempString = null;
                    // 一次读入一行，直到读入null为文件结束
                    while ((tempString = reader.readLine()) != null) {
                        if (tempString.contains("content/" + tableName + ".html")) {
                            alreadyHasThisContent = true;
                            break;
                        }
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                } finally {
                    if (reader != null) {
                        try {
                            reader.close();
                        } catch (IOException e1) {
                        }
                    }
                }
                if (alreadyHasThisContent == true) {
                    return;
                }
            }
            //如果文件不存在，则创建文件
            file.createNewFile();
            if (System.currentTimeMillis() - file.lastModified() > 60000) {
                file.delete();
                file = new File(htmlPath + "/leftFramePage.html");
                //如果文件不存在，则创建文件
                file.createNewFile();
            }
            fileOutputStream = new FileOutputStream(file, true);
            bufferedWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream, "utf-8"));
            bufferedWriter.write("<div class='navigate' onclick=\"$('.class_section_iframe').attr('src','content/" + tableName + ".html?rand='+Math.random());\"" +
                    "style=\"padding-left:6px;padding-top:6px;padding-bottom:6px;border-top:1px #a6a6a6 solid;border-bottom:1px #a6a6a6 solid;\" >" + tableName + "</div>\n");
            System.out.println("write to file success : "+file.getPath());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (bufferedWriter != null) {
                    bufferedWriter.flush();
                    bufferedWriter.close();
                }
                if (fileOutputStream != null) {
                    fileOutputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void writeBlankPage(String htmlPath, String serverUrl) {
        File file = null;
        OutputStream fileOutputStream = null;
        BufferedWriter bufferedWriter = null;
        try {
            File folder = new File(htmlPath + "");
            folder.mkdirs();
            file = new File(htmlPath + "/blank.html");
            //如果文件不存在，则创建文件
            file.createNewFile();
            fileOutputStream = new FileOutputStream(file);
            bufferedWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream, "utf-8"));
            bufferedWriter.write("<!DOCTYPE html><html><head></head><body style='font-size:16px;'>后台管理系统</body></html>\n");
            System.out.println("write to file success : "+file.getPath());
        } catch (
                IOException e)

        {
            e.printStackTrace();
        } finally

        {
            try {
                if (bufferedWriter != null) {
                    bufferedWriter.flush();
                    bufferedWriter.close();
                }
                if (fileOutputStream != null) {
                    fileOutputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void writeJsCommonCustomJs(String htmlPath, String serverUrl, String tokenErrorStatus) {
        if (serverUrl == null) {
            serverUrl = "http://localhost:8080/";
        }
        File file = null;
        OutputStream fileOutputStream = null;
        BufferedWriter bufferedWriter = null;
        try {
            File folder = new File(htmlPath + "/js/common");
            folder.mkdirs();
            file = new File(htmlPath + "/js/common/custom.js");
            //如果文件不存在，则创建文件
            if (!file.exists()) {
                file.createNewFile();
                fileOutputStream = new FileOutputStream(file);
                bufferedWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream, "utf-8"));
                bufferedWriter.write("\n");
                bufferedWriter.write("\n");
                bufferedWriter.write("\n");
                bufferedWriter.write("\n");
                bufferedWriter.write("\n");
                bufferedWriter.write("\n");
                System.out.println("write to file success : " + file.getPath());
            } else {
                System.out.println("write to file success : "+file.getPath());
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (bufferedWriter != null) {
                    bufferedWriter.flush();
                    bufferedWriter.close();
                }
                if (fileOutputStream != null) {
                    fileOutputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void writeJsPlusIconsSvg(String htmlPath, String serverUrl) {
        File file = null;
        OutputStream fileOutputStream = null;
        BufferedWriter bufferedWriter = null;
        try {
            File folder = new File(htmlPath + "/js/plus");
            folder.mkdirs();
            file = new File(htmlPath + "/js/plus/icons.svg");
            //如果文件不存在，则创建文件
            file.createNewFile();
            fileOutputStream = new FileOutputStream(file);
            bufferedWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream, "utf-8"));
            bufferedWriter.write("<svg xmlns=\"http://www.w3.org/2000/svg\"><symbol id=\"trumbowyg-blockquote\" viewBox=\"0 0 72 72\"><path d=\"M21.3 31.9h-.6c.8-1.2 1.9-2.2 3.4-3.2 2.1-1.4 5-2.7 9.2-3.3l-1.4-8.9c-4.7.7-8.5 2.1-11.7 4-2.4 1.4-4.3 3.1-5.8 4.9-2.3 2.7-3.7 5.7-4.5 8.5-.8 2.8-1 5.4-1 7.5 0 2.3.3 4 .4 4.8 0 .1.1.3.1.4 1.2 5.4 6.1 9.5 11.9 9.5 6.7 0 12.2-5.4 12.2-12.2s-5.5-12-12.2-12zM49.5 31.9h-.6c.8-1.2 1.9-2.2 3.4-3.2 2.1-1.4 5-2.7 9.2-3.3l-1.4-8.9c-4.7.7-8.5 2.1-11.7 4-2.4 1.4-4.3 3.1-5.8 4.9-2.3 2.7-3.7 5.7-4.5 8.5-.8 2.8-1 5.4-1 7.5 0 2.3.3 4 .4 4.8 0 .1.1.3.1.4 1.2 5.4 6.1 9.5 11.9 9.5 6.7 0 12.2-5.4 12.2-12.2s-5.5-12-12.2-12z\"/></symbol><symbol id=\"trumbowyg-bold\" viewBox=\"0 0 72 72\"><path d=\"M51.1 37.8c-1.1-1.4-2.5-2.5-4.2-3.3 1.2-.8 2.1-1.8 2.8-3 1-1.6 1.5-3.5 1.5-5.3 0-2-.6-4-1.7-5.8-1.1-1.8-2.8-3.2-4.8-4.1-2-.9-4.6-1.3-7.8-1.3h-16v42h16.3c2.6 0 4.8-.2 6.7-.7 1.9-.5 3.4-1.2 4.7-2.1 1.3-1 2.4-2.4 3.2-4.1.9-1.7 1.3-3.6 1.3-5.7.2-2.5-.5-4.7-2-6.6zM40.8 50.2c-.6.1-1.8.2-3.4.2h-9V38.5h8.3c2.5 0 4.4.2 5.6.6 1.2.4 2 1 2.7 2 .6.9 1 2 1 3.3 0 1.1-.2 2.1-.7 2.9-.5.9-1 1.5-1.7 1.9-.8.4-1.7.8-2.8 1zm2.6-20.4c-.5.7-1.3 1.3-2.5 1.6-.8.3-2.5.4-4.8.4h-7.7V21.6h7.1c1.4 0 2.6 0 3.6.1s1.7.2 2.2.4c1 .3 1.7.8 2.2 1.7.5.9.8 1.8.8 3-.1 1.3-.4 2.2-.9 3z\"/></symbol><symbol id=\"trumbowyg-close\" viewBox=\"0 0 72 72\"><path d=\"M57 20.5l-5.4-5.4-15.5 15.5-15.6-15.5-5.4 5.4L30.7 36 15.1 51.5l5.4 5.4 15.6-15.5 15.5 15.5 5.4-5.4L41.5 36z\"/></symbol><symbol id=\"trumbowyg-create-link\" viewBox=\"0 0 72 72\"><path d=\"M31.1 48.9l-6.7 6.7c-.8.8-1.6.9-2.1.9s-1.4-.1-2.1-.9L15 50.4c-1.1-1.1-1.1-3.1 0-4.2l6.1-6.1.2-.2 6.5-6.5c-1.2-.6-2.5-.9-3.8-.9-2.3 0-4.6.9-6.3 2.6L11 41.8c-3.5 3.5-3.5 9.2 0 12.7l5.2 5.2c1.7 1.7 4 2.6 6.3 2.6s4.6-.9 6.3-2.6l6.7-6.7c2.5-2.6 3.1-6.7 1.5-10l-5.9 5.9zM38.7 22.5l6.7-6.7c.8-.8 1.6-.9 2.1-.9s1.4.1 2.1.9l5.2 5.2c1.1 1.1 1.1 3.1 0 4.2l-6.1 6.1-.2.2L42 38c1.2.6 2.5.9 3.8.9 2.3 0 4.6-.9 6.3-2.6l6.7-6.7c3.5-3.5 3.5-9.2 0-12.7l-5.2-5.2c-1.7-1.7-4-2.6-6.3-2.6s-4.6.9-6.3 2.6l-6.7 6.7c-2.7 2.7-3.3 6.9-1.7 10.2l6.1-6.1c0 .1 0 .1 0 0z\"/><path d=\"M44.2 30.5c.2-.2.4-.6.4-.9 0-.3-.1-.6-.4-.9l-2.3-2.3c-.3-.2-.6-.4-.9-.4-.3 0-.6.1-.9.4L25.9 40.6c-.2.2-.4.6-.4.9 0 .3.1.6.4.9l2.3 2.3c.2.2.6.4.9.4.3 0 .6-.1.9-.4l14.2-14.2zM49.9 55.4h-8.5v-5h8.5v-8.9h5.2v8.9h8.5v5h-8.5v8.9h-5.2v-8.9z\"/></symbol><symbol id=\"trumbowyg-del\" viewBox=\"0 0 72 72\"><path d=\"M45.8 45c0 1-.3 1.9-.9 2.8-.6.9-1.6 1.6-3 2.1s-3.1.8-5 .8c-2.1 0-4-.4-5.7-1.1-1.7-.7-2.9-1.7-3.6-2.7-.8-1.1-1.3-2.6-1.5-4.5l-.1-.8-6.7.6v.9c.1 2.8.9 5.4 2.3 7.6 1.5 2.3 3.5 4 6.1 5.1 2.6 1.1 5.7 1.6 9.4 1.6 2.9 0 5.6-.5 8-1.6 2.4-1.1 4.3-2.7 5.6-4.7 1.3-2 2-4.2 2-6.5 0-1.6-.3-3.1-.9-4.5l-.2-.6H44c0 .1 1.8 2.3 1.8 5.5zM29 28.9c-.8-.8-1.2-1.7-1.2-2.9 0-.7.1-1.3.4-1.9.3-.6.7-1.1 1.4-1.6.6-.5 1.4-.9 2.5-1.1 1.1-.3 2.4-.4 3.9-.4 2.9 0 5 .6 6.3 1.7 1.3 1.1 2.1 2.7 2.4 5.1l.1.9 6.8-.5v-.9c-.1-2.5-.8-4.7-2.1-6.7s-3.2-3.5-5.6-4.5c-2.4-1-5.1-1.5-8.1-1.5-2.8 0-5.3.5-7.6 1.4-2.3 1-4.2 2.4-5.4 4.3-1.2 1.9-1.9 3.9-1.9 6.1 0 1.7.4 3.4 1.2 4.9l.3.5h11.8c-2.3-.9-3.9-1.7-5.2-2.9zm13.3-6.2zM22.7 20.3zM13 34.1h46.1v3.4H13z\"/></symbol><symbol id=\"trumbowyg-em\" viewBox=\"0 0 72 72\"><path d=\"M26 57l10.1-42h7.2L33.2 57H26z\"/></symbol><symbol id=\"trumbowyg-fontsize\" viewBox=\"0 0 24 24\"><path d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M9 4v3h5v12h3V7h5V4H9zm-6 8h3v7h3v-7h3V9H3v3z\"/></symbol><symbol id=\"trumbowyg-fullscreen\" viewBox=\"0 0 72 72\"><path d=\"M25.2 7.1H7.1v17.7l6.7-6.5 10.5 10.5 4.5-4.5-10.4-10.5zM47.2 7.1l6.5 6.7-10.5 10.5 4.5 4.5 10.5-10.4 6.7 6.8V7.1zM47.7 43.2l-4.5 4.5 10.4 10.5-6.8 6.7h18.1V47.2l-6.7 6.5zM24.3 43.2L13.8 53.6l-6.7-6.8v18.1h17.7l-6.5-6.7 10.5-10.5z\"/><path fill=\"currentColor\" d=\"M10.7 28.8h18.1V11.2l-6.6 6.4L11.6 7.1l-4.5 4.5 10.5 10.5zM60.8 28.8l-6.4-6.6 10.5-10.6-4.5-4.5-10.5 10.5-6.7-6.9v18.1zM60.4 64.9l4.5-4.5-10.5-10.5 6.9-6.7H43.2v17.6l6.6-6.4zM11.6 64.9l10.5-10.5 6.7 6.9V43.2H11.1l6.5 6.6L7.1 60.4z\"/></symbol><symbol id=\"trumbowyg-h1\" viewBox=\"0 0 72 72\"><path d=\"M6.4 14.9h7.4v16.7h19.1V14.9h7.4V57h-7.4V38H13.8v19H6.4V14.9zM47.8 22.5c1.4 0 2.8-.1 4.1-.4 1.3-.2 2.5-.6 3.6-1.2 1.1-.5 2-1.3 2.8-2.1.8-.9 1.3-1.9 1.5-3.2h5.5v41.2h-7.4v-29H47.8v-5.3z\"/></symbol><symbol id=\"trumbowyg-h2\" viewBox=\"0 0 72 72\"><path d=\"M1.5 14.9h7.4v16.7H28V14.9h7.4V57H28V38H8.8v19H1.5V14.9zM70.2 56.9H42c0-3.4.9-6.4 2.5-9s3.8-4.8 6.6-6.7c1.3-1 2.7-1.9 4.2-2.9 1.5-.9 2.8-1.9 4-3 1.2-1.1 2.2-2.2 3-3.4.8-1.2 1.2-2.7 1.2-4.3 0-.7-.1-1.5-.3-2.4s-.5-1.6-1-2.4c-.5-.7-1.2-1.3-2.1-1.8-.9-.5-2.1-.7-3.5-.7-1.3 0-2.4.3-3.3.8s-1.6 1.3-2.1 2.2-.9 2-1.2 3.3c-.3 1.3-.4 2.6-.4 4.1h-6.7c0-2.3.3-4.4.9-6.3.6-1.9 1.5-3.6 2.7-5 1.2-1.4 2.7-2.5 4.4-3.3 1.7-.8 3.8-1.2 6.1-1.2 2.5 0 4.6.4 6.3 1.2 1.7.8 3.1 1.9 4.1 3.1 1 1.3 1.8 2.6 2.2 4.1.4 1.5.6 2.9.6 4.2 0 1.6-.3 3.1-.8 4.5-.5 1.3-1.2 2.6-2.1 3.7-.9 1.1-1.8 2.2-2.9 3.1-1.1.9-2.2 1.8-3.4 2.7-1.2.8-2.4 1.6-3.5 2.4-1.2.7-2.3 1.5-3.3 2.2-1 .7-1.9 1.5-2.6 2.3-.7.8-1.3 1.7-1.5 2.6h20.1v5.9z\"/></symbol><symbol id=\"trumbowyg-h3\" viewBox=\"0 0 72 72\"><path d=\"M1.4 14.5h7.4v16.7h19.1V14.5h7.4v42.1h-7.4v-19H8.8v19H1.4V14.5zM53.1 32.4c1.1 0 2.2 0 3.3-.2 1.1-.2 2.1-.5 2.9-1 .9-.5 1.6-1.2 2.1-2 .5-.9.8-1.9.8-3.2 0-1.8-.6-3.2-1.8-4.2-1.2-1.1-2.7-1.6-4.6-1.6-1.2 0-2.2.2-3.1.7-.9.5-1.6 1.1-2.2 1.9-.6.8-1 1.7-1.3 2.7-.3 1-.4 2-.4 3.1h-6.7c.1-2 .5-3.9 1.1-5.6.7-1.7 1.6-3.2 2.7-4.4s2.6-2.2 4.2-2.9c1.6-.7 3.5-1.1 5.6-1.1 1.6 0 3.2.2 4.7.7 1.6.5 2.9 1.2 4.2 2.1 1.2.9 2.2 2.1 3 3.4.7 1.4 1.1 3 1.1 4.8 0 2.1-.5 3.9-1.4 5.4-.9 1.6-2.4 2.7-4.4 3.4v.1c2.4.5 4.2 1.6 5.5 3.5 1.3 1.9 2 4.1 2 6.8 0 2-.4 3.7-1.2 5.3-.8 1.6-1.8 2.9-3.2 3.9-1.3 1.1-2.9 1.9-4.7 2.5-1.8.6-3.6.9-5.6.9-2.4 0-4.5-.3-6.3-1s-3.3-1.7-4.5-2.9c-1.2-1.3-2.1-2.8-2.7-4.5-.6-1.8-1-3.7-1-5.9h6.7c-.1 2.5.5 4.6 1.9 6.3 1.3 1.7 3.3 2.5 5.9 2.5 2.2 0 4.1-.6 5.6-1.9 1.5-1.3 2.3-3.1 2.3-5.4 0-1.6-.3-2.9-.9-3.8-.6-.9-1.5-1.7-2.5-2.2-1-.5-2.2-.8-3.4-.9-1.3-.1-2.6-.2-3.9-.1v-5.2z\"/></symbol><symbol id=\"trumbowyg-h4\" viewBox=\"0 0 72 72\"><path d=\"M1.5 14.9h7.4v16.7H28V14.9h7.4V57H28V38H8.9v19H1.5V14.9zM70.5 47.2h-5.3V57h-6.4v-9.8H41.2v-6.7l17.7-24.8h6.4v26.2h5.3v5.3zm-24.2-5.3h12.5V23.7h-.1L46.3 41.9z\"/></symbol><symbol id=\"trumbowyg-horizontal-rule\" viewBox=\"0 0 72 72\"><path d=\"M9.1 32h54v8h-54z\"/></symbol><symbol id=\"trumbowyg-insert-image\" viewBox=\"0 0 72 72\"><path d=\"M64 17v38H8V17h56m8-8H0v54h72V9z\"/><path d=\"M17.5 22C15 22 13 24 13 26.5s2 4.5 4.5 4.5 4.5-2 4.5-4.5-2-4.5-4.5-4.5zM16 50h27L29.5 32zM36 36.2l8.9-8.5L60.2 50H45.9S35.6 35.9 36 36.2z\"/></symbol><symbol id=\"trumbowyg-italic\" viewBox=\"0 0 72 72\"><path d=\"M26 57l10.1-42h7.2L33.2 57H26z\"/></symbol><symbol id=\"trumbowyg-justify-center\" viewBox=\"0 0 72 72\"><path d=\"M9 14h54v8H9zM9 50h54v8H9zM18 32h36v8H18z\"/></symbol><symbol id=\"trumbowyg-justify-full\" viewBox=\"0 0 72 72\"><path d=\"M9 14h54v8H9zM9 50h54v8H9zM9 32h54v8H9z\"/></symbol><symbol id=\"trumbowyg-justify-left\" viewBox=\"0 0 72 72\"><path d=\"M9 14h54v8H9zM9 50h54v8H9zM9 32h36v8H9z\"/></symbol><symbol id=\"trumbowyg-justify-right\" viewBox=\"0 0 72 72\"><path d=\"M9 14h54v8H9zM9 50h54v8H9zM27 32h36v8H27z\"/></symbol><symbol id=\"trumbowyg-lineheight\" viewBox=\"0 0 72 72\"><path d=\"M31 14h36v8H31zM31 50h36v8H31zM31 32h30v8H31z\"/><path stroke-miterlimit=\"10\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3.6428\" d=\"M7.82 47.207l8.332 8.15 8.106-8.15M24.276 24.635l-8.333-8.15-8.105 8.15\"/><path d=\"M14.347 53.761v-36h3.385v36z\"/></symbol><symbol id=\"trumbowyg-link\" viewBox=\"0 0 72 72\"><path d=\"M30.9 49.1l-6.7 6.7c-.8.8-1.6.9-2.1.9s-1.4-.1-2.1-.9l-5.2-5.2c-1.1-1.1-1.1-3.1 0-4.2l6.1-6.1.2-.2 6.5-6.5c-1.2-.6-2.5-.9-3.8-.9-2.3 0-4.6.9-6.3 2.6L10.8 42c-3.5 3.5-3.5 9.2 0 12.7l5.2 5.2c1.7 1.7 4 2.6 6.3 2.6s4.6-.9 6.3-2.6l6.7-6.7C38 50.5 38.6 46.3 37 43l-6.1 6.1zM38.5 22.7l6.7-6.7c.8-.8 1.6-.9 2.1-.9s1.4.1 2.1.9l5.2 5.2c1.1 1.1 1.1 3.1 0 4.2l-6.1 6.1-.2.2-6.5 6.5c1.2.6 2.5.9 3.8.9 2.3 0 4.6-.9 6.3-2.6l6.7-6.7c3.5-3.5 3.5-9.2 0-12.7l-5.2-5.2c-1.7-1.7-4-2.6-6.3-2.6s-4.6.9-6.3 2.6l-6.7 6.7c-2.7 2.7-3.3 6.9-1.7 10.2l6.1-6.1z\"/><path d=\"M44.1 30.7c.2-.2.4-.6.4-.9 0-.3-.1-.6-.4-.9l-2.3-2.3c-.2-.2-.6-.4-.9-.4-.3 0-.6.1-.9.4L25.8 40.8c-.2.2-.4.6-.4.9 0 .3.1.6.4.9l2.3 2.3c.2.2.6.4.9.4.3 0 .6-.1.9-.4l14.2-14.2z\"/></symbol><symbol id=\"trumbowyg-ordered-list\" viewBox=\"0 0 72 72\"><path d=\"M27 14h36v8H27zM27 50h36v8H27zM27 32h36v8H27zM11.8 15.8V22h1.8v-7.8h-1.5l-2.1 1 .3 1.3zM12.1 38.5l.7-.6c1.1-1 2.1-2.1 2.1-3.4 0-1.4-1-2.4-2.7-2.4-1.1 0-2 .4-2.6.8l.5 1.3c.4-.3 1-.6 1.7-.6.9 0 1.3.5 1.3 1.1 0 .9-.9 1.8-2.6 3.3l-1 .9V40H15v-1.5h-2.9zM13.3 53.9c1-.4 1.4-1 1.4-1.8 0-1.1-.9-1.9-2.6-1.9-1 0-1.9.3-2.4.6l.4 1.3c.3-.2 1-.5 1.6-.5.8 0 1.2.3 1.2.8 0 .7-.8.9-1.4.9h-.7v1.3h.7c.8 0 1.6.3 1.6 1.1 0 .6-.5 1-1.4 1-.7 0-1.5-.3-1.8-.5l-.4 1.4c.5.3 1.3.6 2.3.6 2 0 3.2-1 3.2-2.4 0-1.1-.8-1.8-1.7-1.9z\"/></symbol><symbol id=\"trumbowyg-p\" viewBox=\"0 0 72 72\"><path d=\"M47.8 15.1H30.1c-4.7 0-8.5 3.7-8.5 8.4s3.7 8.4 8.4 8.4v25h7V19.8h3v37.1h4.1V19.8h3.7v-4.7z\"/></symbol><symbol id=\"trumbowyg-redo\" viewBox=\"0 0 72 72\"><path d=\"M10.8 51.2c0-5.1 2.1-9.7 5.4-13.1 3.3-3.3 8-5.4 13.1-5.4H46v-12L61.3 36 45.9 51.3V39.1H29.3c-3.3 0-6.4 1.3-8.5 3.5-2.2 2.2-3.5 5.2-3.5 8.5h-6.5z\"/></symbol><symbol id=\"trumbowyg-removeformat\" viewBox=\"0 0 72 72\"><path d=\"M58.2 54.6L52 48.5l3.6-3.6 6.1 6.1 6.4-6.4 3.8 3.8-6.4 6.4 6.1 6.1-3.6 3.6-6.1-6.1-6.4 6.4-3.7-3.8 6.4-6.4zM21.7 52.1H50V57H21.7zM18.8 15.2h34.1v6.4H39.5v24.2h-7.4V21.5H18.8v-6.3z\"/></symbol><symbol id=\"trumbowyg-strikethrough\" viewBox=\"0 0 72 72\"><path d=\"M45.8 45c0 1-.3 1.9-.9 2.8-.6.9-1.6 1.6-3 2.1s-3.1.8-5 .8c-2.1 0-4-.4-5.7-1.1-1.7-.7-2.9-1.7-3.6-2.7-.8-1.1-1.3-2.6-1.5-4.5l-.1-.8-6.7.6v.9c.1 2.8.9 5.4 2.3 7.6 1.5 2.3 3.5 4 6.1 5.1 2.6 1.1 5.7 1.6 9.4 1.6 2.9 0 5.6-.5 8-1.6 2.4-1.1 4.3-2.7 5.6-4.7 1.3-2 2-4.2 2-6.5 0-1.6-.3-3.1-.9-4.5l-.2-.6H44c0 .1 1.8 2.3 1.8 5.5zM29 28.9c-.8-.8-1.2-1.7-1.2-2.9 0-.7.1-1.3.4-1.9.3-.6.7-1.1 1.4-1.6.6-.5 1.4-.9 2.5-1.1 1.1-.3 2.4-.4 3.9-.4 2.9 0 5 .6 6.3 1.7 1.3 1.1 2.1 2.7 2.4 5.1l.1.9 6.8-.5v-.9c-.1-2.5-.8-4.7-2.1-6.7s-3.2-3.5-5.6-4.5c-2.4-1-5.1-1.5-8.1-1.5-2.8 0-5.3.5-7.6 1.4-2.3 1-4.2 2.4-5.4 4.3-1.2 1.9-1.9 3.9-1.9 6.1 0 1.7.4 3.4 1.2 4.9l.3.5h11.8c-2.3-.9-3.9-1.7-5.2-2.9zm13.3-6.2zM22.7 20.3zM13 34.1h46.1v3.4H13z\"/></symbol><symbol id=\"trumbowyg-strong\" viewBox=\"0 0 72 72\"><path d=\"M51.1 37.8c-1.1-1.4-2.5-2.5-4.2-3.3 1.2-.8 2.1-1.8 2.8-3 1-1.6 1.5-3.5 1.5-5.3 0-2-.6-4-1.7-5.8-1.1-1.8-2.8-3.2-4.8-4.1-2-.9-4.6-1.3-7.8-1.3h-16v42h16.3c2.6 0 4.8-.2 6.7-.7 1.9-.5 3.4-1.2 4.7-2.1 1.3-1 2.4-2.4 3.2-4.1.9-1.7 1.3-3.6 1.3-5.7.2-2.5-.5-4.7-2-6.6zM40.8 50.2c-.6.1-1.8.2-3.4.2h-9V38.5h8.3c2.5 0 4.4.2 5.6.6 1.2.4 2 1 2.7 2 .6.9 1 2 1 3.3 0 1.1-.2 2.1-.7 2.9-.5.9-1 1.5-1.7 1.9-.8.4-1.7.8-2.8 1zm2.6-20.4c-.5.7-1.3 1.3-2.5 1.6-.8.3-2.5.4-4.8.4h-7.7V21.6h7.1c1.4 0 2.6 0 3.6.1s1.7.2 2.2.4c1 .3 1.7.8 2.2 1.7.5.9.8 1.8.8 3-.1 1.3-.4 2.2-.9 3z\"/></symbol><symbol id=\"trumbowyg-subscript\" viewBox=\"0 0 72 72\"><path d=\"M32 15h7.8L56 57.1h-7.9L44.3 46H27.4l-4 11.1h-7.6L32 15zm-2.5 25.4h12.9L36 22.3h-.2l-6.3 18.1zM58.7 59.9c.6-1.4 2-2.8 4.1-4.4 1.9-1.3 3.1-2.3 3.7-2.9.8-.9 1.3-1.9 1.3-3 0-.9-.2-1.6-.7-2.2-.5-.6-1.2-.9-2.1-.9-1.2 0-2.1.5-2.5 1.4-.3.5-.4 1.4-.5 2.5h-4c.1-1.8.4-3.2 1-4.3 1.1-2.1 3-3.1 5.8-3.1 2.2 0 3.9.6 5.2 1.8 1.3 1.2 1.9 2.8 1.9 4.8 0 1.5-.5 2.9-1.4 4.1-.6.8-1.6 1.7-3 2.6L66 57.7c-1 .7-1.7 1.2-2.1 1.6-.4.3-.7.7-1 1.1H72V64H57.8c0-1.5.3-2.8.9-4.1z\"/></symbol><symbol id=\"trumbowyg-superscript\" viewBox=\"0 0 72 72\"><path d=\"M32 15h7.8L56 57.1h-7.9l-4-11.1H27.4l-4 11.1h-7.6L32 15zm-2.5 25.4h12.9L36 22.3h-.2l-6.3 18.1zM49.6 28.8c.5-1.1 1.6-2.3 3.4-3.6 1.5-1.1 2.5-1.9 3-2.4.7-.7 1-1.6 1-2.4 0-.7-.2-1.3-.6-1.8-.4-.5-1-.7-1.7-.7-1 0-1.7.4-2.1 1.1-.2.4-.3 1.1-.4 2.1H49c.1-1.5.3-2.6.8-3.5.9-1.7 2.5-2.6 4.8-2.6 1.8 0 3.2.5 4.3 1.5 1.1 1 1.6 2.3 1.6 4 0 1.3-.4 2.4-1.1 3.4-.5.7-1.3 1.4-2.4 2.2l-1.3 1c-.8.6-1.4 1-1.7 1.3-.3.3-.6.6-.8.9h7.4v3H48.8c0-1.3.3-2.4.8-3.5z\"/></symbol><symbol id=\"trumbowyg-table\" viewBox=\"0 0 72 72\"><path d=\"M25.686 51.38v-6.347q0-.462-.297-.76-.298-.297-.761-.297H14.04q-.463 0-.761.297-.298.298-.298.76v6.346q0 .463.298.76.298.298.76.298h10.589q.463 0 .76-.298.298-.297.298-.76zm0-12.692v-6.346q0-.463-.297-.76-.298-.298-.761-.298H14.04q-.463 0-.761.298-.298.297-.298.76v6.346q0 .462.298.76.298.297.76.297h10.589q.463 0 .76-.297.298-.298.298-.76zm16.94 12.691v-6.346q0-.462-.297-.76-.298-.297-.761-.297H30.98q-.463 0-.76.297-.299.298-.299.76v6.346q0 .463.298.76.298.298.761.298h10.588q.463 0 .76-.298.299-.297.299-.76zm-16.94-25.383v-6.345q0-.463-.297-.76-.298-.298-.761-.298H14.04q-.463 0-.761.297-.298.298-.298.76v6.346q0 .463.298.76.298.298.76.298h10.589q.463 0 .76-.298.298-.297.298-.76zm16.94 12.692v-6.346q0-.463-.297-.76-.298-.298-.761-.298H30.98q-.463 0-.76.298-.299.297-.299.76v6.346q0 .462.298.76.298.297.761.297h10.588q.463 0 .76-.297.299-.298.299-.76zm16.94 12.691v-6.346q0-.462-.297-.76-.298-.297-.76-.297H47.92q-.463 0-.76.297-.298.298-.298.76v6.346q0 .463.297.76.298.298.761.298h10.588q.463 0 .761-.298.298-.297.298-.76zm-16.94-25.383v-6.345q0-.463-.297-.76-.298-.298-.761-.298H30.98q-.463 0-.76.297-.299.298-.299.76v6.346q0 .463.298.76.298.298.761.298h10.588q.463 0 .76-.298.299-.297.299-.76zm16.94 12.692v-6.346q0-.463-.297-.76-.298-.298-.76-.298H47.92q-.463 0-.76.298-.298.297-.298.76v6.346q0 .462.297.76.298.297.761.297h10.588q.463 0 .761-.297.298-.298.298-.76zm0-12.692v-6.345q0-.463-.297-.76-.298-.298-.76-.298H47.92q-.463 0-.76.297-.298.298-.298.76v6.346q0 .463.297.76.298.298.761.298h10.588q.463 0 .761-.298.298-.297.298-.76zm4.236-10.576v35.96q0 2.18-1.555 3.734-1.555 1.553-3.739 1.553H14.04q-2.184 0-3.739-1.553-1.555-1.553-1.555-3.735V15.42q0-2.181 1.555-3.735 1.555-1.553 3.739-1.553h44.468q2.184 0 3.739 1.553 1.555 1.554 1.555 3.735z\"/></symbol><symbol id=\"trumbowyg-underline\" viewBox=\"0 0 72 72\"><path d=\"M36 35zM15.2 55.9h41.6V59H15.2zM21.1 13.9h6.4v21.2c0 1.2.1 2.5.2 3.7.1 1.3.5 2.4 1 3.4.6 1 1.4 1.8 2.6 2.5 1.1.6 2.7 1 4.8 1 2.1 0 3.7-.3 4.8-1 1.1-.6 2-1.5 2.6-2.5.6-1 .9-2.1 1-3.4.1-1.3.2-2.5.2-3.7V13.9H51v23.3c0 2.3-.4 4.4-1.1 6.1-.7 1.7-1.7 3.2-3 4.4-1.3 1.2-2.9 2-4.7 2.6-1.8.6-3.9.9-6.1.9-2.2 0-4.3-.3-6.1-.9-1.8-.6-3.4-1.5-4.7-2.6-1.3-1.2-2.3-2.6-3-4.4-.7-1.7-1.1-3.8-1.1-6.1V13.9z\"/></symbol><symbol id=\"trumbowyg-undo\" viewBox=\"0 0 72 72\"><path d=\"M61.2 51.2c0-5.1-2.1-9.7-5.4-13.1-3.3-3.3-8-5.4-13.1-5.4H26.1v-12L10.8 36l15.3 15.3V39.1h16.7c3.3 0 6.4 1.3 8.5 3.5 2.2 2.2 3.5 5.2 3.5 8.5h6.4z\"/></symbol><symbol id=\"trumbowyg-unlink\" viewBox=\"0 0 72 72\"><path d=\"M30.9 49.1l-6.7 6.7c-.8.8-1.6.9-2.1.9s-1.4-.1-2.1-.9l-5.2-5.2c-1.1-1.1-1.1-3.1 0-4.2l6.1-6.1.2-.2 6.5-6.5c-1.2-.6-2.5-.9-3.8-.9-2.3 0-4.6.9-6.3 2.6L10.8 42c-3.5 3.5-3.5 9.2 0 12.7l5.2 5.2c1.7 1.7 4 2.6 6.3 2.6s4.6-.9 6.3-2.6l6.7-6.7C38 50.5 38.6 46.3 37 43l-6.1 6.1zM38.5 22.7l6.7-6.7c.8-.8 1.6-.9 2.1-.9s1.4.1 2.1.9l5.2 5.2c1.1 1.1 1.1 3.1 0 4.2l-6.1 6.1-.2.2-6.5 6.5c1.2.6 2.5.9 3.8.9 2.3 0 4.6-.9 6.3-2.6l6.7-6.7c3.5-3.5 3.5-9.2 0-12.7l-5.2-5.2c-1.7-1.7-4-2.6-6.3-2.6s-4.6.9-6.3 2.6l-6.7 6.7c-2.7 2.7-3.3 6.9-1.7 10.2l6.1-6.1z\"/><path d=\"M44.1 30.7c.2-.2.4-.6.4-.9 0-.3-.1-.6-.4-.9l-2.3-2.3c-.2-.2-.6-.4-.9-.4-.3 0-.6.1-.9.4L25.8 40.8c-.2.2-.4.6-.4.9 0 .3.1.6.4.9l2.3 2.3c.2.2.6.4.9.4.3 0 .6-.1.9-.4l14.2-14.2zM41.3 55.8v-5h22.2v5H41.3z\"/></symbol><symbol id=\"trumbowyg-unordered-list\" viewBox=\"0 0 72 72\"><path d=\"M27 14h36v8H27zM27 50h36v8H27zM9 50h9v8H9zM9 32h9v8H9zM9 14h9v8H9zM27 32h36v8H27z\"/></symbol><symbol id=\"trumbowyg-view-html\" viewBox=\"0 0 72 72\"><path fill=\"none\" stroke=\"currentColor\" stroke-width=\"8\" stroke-miterlimit=\"10\" d=\"M26.9 17.9L9 36.2 26.9 54M45 54l17.9-18.3L45 17.9\"/></symbol><symbol id=\"trumbowyg-base64\" viewBox=\"0 0 72 72\"><path d=\"M64 17v38H8V17h56m8-8H0v54h72V9z\"/><path d=\"M29.9 28.9c-.5-.5-1.1-.8-1.8-.8s-1.4.2-1.9.7c-.5.4-.9 1-1.2 1.6-.3.6-.5 1.3-.6 2.1-.1.7-.2 1.4-.2 1.9l.1.1c.6-.8 1.2-1.4 2-1.8.8-.4 1.7-.5 2.7-.5.9 0 1.8.2 2.6.6.8.4 1.6.9 2.2 1.5.6.6 1 1.3 1.2 2.2.3.8.4 1.6.4 2.5 0 1.1-.2 2.1-.5 3-.3.9-.8 1.7-1.5 2.4-.6.7-1.4 1.2-2.3 1.6-.9.4-1.9.6-3 .6-1.6 0-2.8-.3-3.9-.9-1-.6-1.8-1.4-2.5-2.4-.6-1-1-2.1-1.3-3.4-.2-1.3-.4-2.6-.4-3.9 0-1.3.1-2.6.4-3.8.3-1.3.8-2.4 1.4-3.5.7-1 1.5-1.9 2.5-2.5 1-.6 2.3-1 3.8-1 .9 0 1.7.1 2.5.4.8.3 1.4.6 2 1.1.6.5 1.1 1.1 1.4 1.8.4.7.6 1.5.7 2.5h-4c0-1-.3-1.6-.8-2.1zm-3.5 6.8c-.4.2-.8.5-1 .8-.3.4-.5.8-.6 1.2-.1.5-.2 1-.2 1.5s.1.9.2 1.4c.1.5.4.9.6 1.2.3.4.6.7 1 .9.4.2.9.3 1.4.3.5 0 1-.1 1.3-.3.4-.2.7-.5 1-.9.3-.4.5-.8.6-1.2.1-.5.2-.9.2-1.4 0-.5-.1-1-.2-1.4-.1-.5-.3-.9-.6-1.2-.3-.4-.6-.7-1-.9-.4-.2-.9-.3-1.4-.3-.4 0-.9.1-1.3.3zM36.3 41.3v-3.8l9-12.1H49v12.4h2.7v3.5H49v4.8h-4v-4.8h-8.7zM45 30.7l-5.3 7.2h5.4l-.1-7.2z\"/></symbol><symbol id=\"trumbowyg-back-color\" viewBox=\"0 0 72 72\"><path d=\"M36.5 22.3l-6.3 18.1H43l-6.3-18.1z\"/><path d=\"M9 8.9v54.2h54.1V8.9H9zm39.9 48.2L45 46H28.2l-3.9 11.1h-7.6L32.8 15h7.8l16.2 42.1h-7.9z\"/></symbol><symbol id=\"trumbowyg-fore-color\" viewBox=\"0 0 72 72\"><path d=\"M32 15h7.8L56 57.1h-7.9l-4-11.1H27.4l-4 11.1h-7.6L32 15zm-2.5 25.4h12.9L36 22.3h-.2l-6.3 18.1z\"/></symbol><symbol id=\"trumbowyg-emoji\" viewBox=\"0 0 72 72\"><path d=\"M36.05 9C21.09 9 8.949 21.141 8.949 36.101c0 14.96 12.141 27.101 27.101 27.101 14.96 0 27.101-12.141 27.101-27.101S51.01 9 36.05 9zm9.757 15.095c2.651 0 4.418 1.767 4.418 4.418s-1.767 4.418-4.418 4.418-4.418-1.767-4.418-4.418 1.767-4.418 4.418-4.418zm-19.479 0c2.651 0 4.418 1.767 4.418 4.418s-1.767 4.418-4.418 4.418-4.418-1.767-4.418-4.418 1.767-4.418 4.418-4.418zm9.722 30.436c-14.093 0-16.261-13.009-16.261-13.009h32.522S50.143 54.531 36.05 54.531z\"/></symbol><symbol id=\"trumbowyg-highlight\" viewBox=\"0 0 60 60\"><path d=\"M11 7c0-2.206-1.794-4-4-4S3 4.794 3 7s1.794 4 4 4 4-1.794 4-4zM7 9c-1.103 0-2-.897-2-2s.897-2 2-2 2 .897 2 2-.897 2-2 2zM16 11c2.206 0 4-1.794 4-4s-1.794-4-4-4-4 1.794-4 4 1.794 4 4 4zm0-6c1.103 0 2 .897 2 2s-.897 2-2 2-2-.897-2-2 .897-2 2-2zM25 11c2.206 0 4-1.794 4-4s-1.794-4-4-4-4 1.794-4 4 1.794 4 4 4zm0-6c1.103 0 2 .897 2 2s-.897 2-2 2-2-.897-2-2 .897-2 2-2z\"/><path d=\"M0 0v60h60V0H0zm2 2h56v10H2V2zm0 56V14h5v44H2zm56 0H9V14h49v44z\"/><path d=\"M5 17H4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2zM5 21H4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2zM5 25H4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2zM5 29H4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2zM5 33H4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2zM5 37H4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2zM5 41H4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2zM5 45H4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2zM5 49H4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2zM5 53H4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2zM13 19h13a1 1 0 1 0 0-2H13a1 1 0 1 0 0 2zM30 19h10a1 1 0 1 0 0-2H30a1 1 0 1 0 0 2zM44 19h2a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2zM35 22a1 1 0 0 0 1 1h15a1 1 0 1 0 0-2H36a1 1 0 0 0-1 1zM32 21H18a1 1 0 1 0 0 2h14a1 1 0 1 0 0-2zM13 23h1a1 1 0 1 0 0-2h-1a1 1 0 1 0 0 2zM13 27h9a1 1 0 1 0 0-2h-9a1 1 0 1 0 0 2zM26 27h2a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2zM46 25H32a1 1 0 1 0 0 2h14a1 1 0 1 0 0-2zM13 31h13a1 1 0 1 0 0-2H13a1 1 0 1 0 0 2zM41 30a1 1 0 0 0-1-1H30a1 1 0 1 0 0 2h10a1 1 0 0 0 1-1zM36 35h8a1 1 0 1 0 0-2h-8a1 1 0 1 0 0 2zM17 34a1 1 0 0 0 1 1h14a1 1 0 1 0 0-2H18a1 1 0 0 0-1 1zM13 35h1a1 1 0 1 0 0-2h-1a1 1 0 1 0 0 2zM13 39h9a1 1 0 1 0 0-2h-9a1 1 0 1 0 0 2zM26 39h2a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2zM31 38a1 1 0 0 0 1 1h15a1 1 0 1 0 0-2H32a1 1 0 0 0-1 1zM13 43h13a1 1 0 1 0 0-2H13a1 1 0 1 0 0 2zM40 41H30a1 1 0 1 0 0 2h10a1 1 0 1 0 0-2zM51 41h-7a1 1 0 1 0 0 2h7a1 1 0 1 0 0-2zM40 45h-4a1 1 0 1 0 0 2h4a1 1 0 1 0 0-2zM17 46a1 1 0 0 0 1 1h14a1 1 0 1 0 0-2H18a1 1 0 0 0-1 1zM13 47h1a1 1 0 1 0 0-2h-1a1 1 0 1 0 0 2zM22 49h-9a1 1 0 1 0 0 2h9a1 1 0 1 0 0-2zM28 49h-2a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2zM39 49h-7a1 1 0 1 0 0 2h7a1 1 0 1 0 0-2zM44 49h-1a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2z\"/></symbol><symbol id=\"trumbowyg-insert-audio\" viewBox=\"0 0 8 8\"><path d=\"M3.344 0L2 2H0v4h2l1.344 2H4V0h-.656zM5 1v1c.152 0 .313.026.469.063H5.5c.86.215 1.5.995 1.5 1.938a1.99 1.99 0 0 1-2 2.001v1a2.988 2.988 0 0 0 3-3 2.988 2.988 0 0 0-3-3zm0 2v2l.25-.031C5.683 4.851 6 4.462 6 4c0-.446-.325-.819-.75-.938v-.031h-.031L5 3z\"/></symbol><symbol id=\"trumbowyg-mathml\" viewBox=\"0 0 445.878 445.878\"><path d=\"M426.024 86.447H209.705l-84.911 298.911c-2.568 7.967-9.854 13.482-18.22 13.771-.236 0-.464.006-.688.006a19.868 19.868 0 0 1-18.436-12.478l-34.714-86.782H19.851C8.884 299.876 0 290.986 0 280.022c0-10.965 8.893-19.854 19.851-19.854H66.18a19.862 19.862 0 0 1 18.436 12.483l19.237 48.09 72.472-260.218a19.855 19.855 0 0 1 18.903-13.781h230.798c10.97 0 19.854 8.89 19.854 19.851s-8.892 19.854-19.856 19.854zm10.699 266.78l-78.259-87.904 74.576-82.783c1.318-1.454 1.638-3.547.857-5.341a4.977 4.977 0 0 0-4.54-2.946h-47.18a4.995 4.995 0 0 0-3.759 1.72l-50.059 58.047-49.674-58.029a4.95 4.95 0 0 0-3.771-1.738H225.58a4.947 4.947 0 0 0-4.521 2.929 4.939 4.939 0 0 0 .824 5.332l73.743 82.81-77.641 87.923a4.977 4.977 0 0 0-.813 5.325 4.978 4.978 0 0 0 4.528 2.92h48.9c1.472 0 2.867-.65 3.807-1.785l51.819-62.181 53.05 62.229a4.972 4.972 0 0 0 3.782 1.743h49.97a4.938 4.938 0 0 0 4.527-2.926 4.966 4.966 0 0 0-.832-5.345z\"/></symbol><symbol id=\"trumbowyg-mention\" viewBox=\"0 0 128 128\"><path fill-rule=\"evenodd\" d=\"M73.309 62.5c-1.53 9.86-8.16 17.85-14.45 17.85-5.61 0-8.5-4.08-8.5-10.54 0-13.089 8.84-24.139 20.06-24.139 2.21 0 3.91.34 5.27.68L73.309 62.5zm14.45 44.2c-6.8 3.57-15.98 5.44-24.65 5.44-25.329 0-43.519-16.15-43.519-44.54 0-32.469 22.78-52.869 48.789-52.869 26.35 0 40.63 17.17 40.63 39.27 0 19.549-9.18 28.899-16.49 28.729-4.76-.17-5.95-4.76-4.25-14.79l5.1-31.449c-4.25-2.38-12.75-4.25-20.23-4.25-24.48 0-39.779 18.87-39.779 39.609 0 13.94 7.99 22.1 19.039 22.1 9.01 0 16.66-4.42 21.93-13.09h.34c.85 9.01 6.63 13.09 14.62 13.09 18.36 0 32.3-15.64 32.3-40.459 0-28.56-21.42-49.13-51.34-49.13C31.83 4.361 6.67 34.451 6.67 69.13c0 33.32 24.82 53.55 53.039 53.55 12.07 0 20.91-1.53 31.11-6.12l-3.06-9.86z\"/></symbol><symbol id=\"trumbowyg-noembed\" viewBox=\"0 0 72 72\"><path d=\"M31.5 33.6V25l11 11-11 11v-8.8z\"/><path d=\"M64 17v38H8V17h56m8-8H0v54h72V9z\"/></symbol><symbol id=\"trumbowyg-preformatted\" viewBox=\"0 0 72 72\"><path d=\"M10.3 33.5c.4 0 .9-.1 1.5-.2s1.2-.3 1.8-.7c.6-.3 1.1-.8 1.5-1.3.4-.5.6-1.3.6-2.1V17.1c0-1.4.3-2.6.8-3.6s1.2-1.9 2-2.5c.8-.7 1.6-1.2 2.5-1.5.9-.3 1.6-.5 2.2-.5h5.3v5.3h-3.2c-.7 0-1.3.1-1.8.4-.4.3-.8.6-1 1-.2.4-.4.9-.4 1.3-.1.5-.1.9-.1 1.4v11.4c0 1.2-.2 2.1-.7 2.9-.5.8-1 1.4-1.7 1.8-.6.4-1.3.8-2 1-.7.2-1.3.3-1.7.4v.1c.5 0 1 .1 1.7.3.7.2 1.3.5 2 .9.6.5 1.2 1.1 1.7 1.9.5.8.7 2 .7 3.4v11.1c0 .4 0 .9.1 1.4.1.5.2.9.4 1.3s.6.7 1 1c.4.3 1 .4 1.8.4h3.2V63h-5.3c-.6 0-1.4-.2-2.2-.5-.9-.3-1.7-.8-2.5-1.5s-1.4-1.5-2-2.5c-.5-1-.8-2.2-.8-3.6V43.5c0-.9-.2-1.7-.6-2.3-.4-.6-.9-1.1-1.5-1.5-.6-.4-1.2-.6-1.8-.7-.6-.1-1.1-.2-1.5-.2v-5.3zM61.8 38.7c-.4 0-1 .1-1.6.2-.6.1-1.2.4-1.8.7-.6.3-1.1.7-1.5 1.3-.4.5-.6 1.3-.6 2.1v12.1c0 1.4-.3 2.6-.8 3.6s-1.2 1.9-2 2.5c-.8.7-1.6 1.2-2.5 1.5-.9.3-1.6.5-2.2.5h-5.3v-5.3h3.2c.7 0 1.3-.1 1.8-.4.4-.3.8-.6 1-1 .2-.4.4-.9.4-1.3.1-.5.1-.9.1-1.4V42.3c0-1.2.2-2.1.7-2.9.5-.8 1-1.4 1.7-1.8.6-.4 1.3-.8 2-1 .7-.2 1.3-.3 1.7-.4v-.1c-.5 0-1-.1-1.7-.3-.7-.2-1.3-.5-2-.9-.6-.4-1.2-1.1-1.7-1.9-.5-.8-.7-2-.7-3.4V18.5c0-.4 0-.9-.1-1.4-.1-.5-.2-.9-.4-1.3s-.6-.7-1-1c-.4-.3-1-.4-1.8-.4h-3.2V9.1h5.3c.6 0 1.4.2 2.2.5.9.3 1.7.8 2.5 1.5s1.4 1.5 2 2.5c.5 1 .8 2.2.8 3.6v11.6c0 .9.2 1.7.6 2.3.4.6.9 1.1 1.5 1.5.6.4 1.2.6 1.8.7.6.1 1.2.2 1.6.2v5.2z\"/></symbol><symbol id=\"trumbowyg-ruby\" viewBox=\"0 0 72 72\"><path d=\"M16.499 24.477h8.018L41.08 67.5H33l-4.04-11.361H11.804L7.764 67.5H0l16.499-43.023zm-2.65 25.907h13.127l-6.438-18.497h-.177l-6.512 18.497zM65.053 16.685c-6.316 1.178-12.025 1.98-17.126 2.408a362.385 362.385 0 0 0-.965 5.833c-.25 1.57-.679 3.907-1.286 7.013 3.033-1.963 5.852-3.266 8.458-3.907 2.639-.642 4.905-.891 6.797-.75 1.891.108 3.746.661 5.566 1.661 1.82.964 3.264 2.408 4.334 4.334 1.104 1.893 1.427 4.088.965 6.584-.466 2.461-1.554 4.494-3.265 6.101-1.679 1.605-3.658 2.783-5.941 3.532-2.283.785-4.853 1.251-7.707 1.391-2.819.144-5.906.161-9.259.056 0-1.642-.287-3.212-.857-4.71l.108-.59c2.711.5 5.246.768 7.601.802 2.39 0 4.529-.195 6.421-.589 1.927-.393 3.605-1.069 5.031-2.031 1.427-.965 2.319-2.319 2.676-4.067.394-1.75.269-3.229-.373-4.443-.644-1.249-1.446-2.213-2.408-2.891-.929-.68-2.161-1.034-3.693-1.071-1.536-.072-3.265.089-5.192.482-1.927.391-3.82 1.14-5.672 2.248a24.308 24.308 0 0 0-4.978 3.907l-4.872-1.981c1.463-5.031 2.355-8.597 2.677-10.703.321-2.105.642-4.067.963-5.887-3.961.25-7.154.411-9.58.481-.215-1.927-.52-3.534-.91-4.817l.32-.32c3.604.32 7.225.446 10.865.375.214-1.355.481-3.103.804-5.245.354-2.175.407-3.621.16-4.336.034-.784.374-1.017 1.017-.695l5.085.749c.428.251.444.573.055.964l-.857.91c-.537 2.89-.981 5.352-1.338 7.385 4.279-.427 9.312-1.393 15.092-2.89l1.284 4.707\"/></symbol><symbol id=\"trumbowyg-col-delete\" viewBox=\"0 0 24 24\"><g transform=\"translate(-326 -532.36)\"><rect width=\"6\" height=\"15\" x=\"335\" y=\"537.36\" fill=\"#ed5565\" stroke=\"#000\" stroke-linejoin=\"round\" stroke-linecap=\"round\" stroke-width=\".837\" rx=\".646\"/><path d=\"M347.58 536.498c-.051-.618-.55-1.138-1.178-1.138H329.6c-.628 0-1.127.52-1.18 1.138h-.02v15.663a1.2 1.2 0 0 0 1.2 1.2h16.801a1.2 1.2 0 0 0 1.2-1.2v-15.663h-.021M334.4 552.16h-4.8v-3.6h4.8v3.6m0-4.7h-4.8v-3.7h4.8v3.7m0-4.9h-4.8v-3.601h4.8v3.6m6 9.601h-4.8v-3.6h4.8v3.6m0-4.7h-4.8v-3.7h4.8v3.7m0-4.9h-4.8v-3.601h4.8v3.6m6.001 9.601h-4.8v-3.6h4.8v3.6m0-4.7h-4.8v-3.7h4.8v3.7m0-4.9h-4.8v-3.601h4.8v3.6\"/></g></symbol><symbol id=\"trumbowyg-col-left\" viewBox=\"0 0 24 24\"><g transform=\"translate(-326 -532.36)\"><rect width=\"6\" height=\"15\" x=\"329\" y=\"537.36\" fill=\"#1ab394\" stroke=\"#000\" stroke-linejoin=\"round\" stroke-linecap=\"round\" stroke-width=\".837\" rx=\".646\"/><path d=\"M347.58 536.498c-.051-.618-.55-1.138-1.178-1.138H329.6c-.628 0-1.127.52-1.18 1.138h-.02v15.663a1.2 1.2 0 0 0 1.2 1.2h16.801a1.2 1.2 0 0 0 1.2-1.2v-15.663h-.021M334.4 552.16h-4.8v-3.6h4.8v3.6m0-4.7h-4.8v-3.7h4.8v3.7m0-4.9h-4.8v-3.601h4.8v3.6m6 9.601h-4.8v-3.6h4.8v3.6m0-4.7h-4.8v-3.7h4.8v3.7m0-4.9h-4.8v-3.601h4.8v3.6m6.001 9.601h-4.8v-3.6h4.8v3.6m0-4.7h-4.8v-3.7h4.8v3.7m0-4.9h-4.8v-3.601h4.8v3.6\"/></g></symbol><symbol id=\"trumbowyg-col-right\" viewBox=\"0 0 24 24\"><g transform=\"matrix(-1 0 0 1 350 -532.36)\"><rect y=\"537.36\" x=\"329\" height=\"15\" width=\"6\" fill=\"#1ab394\" stroke=\"#000\" stroke-linejoin=\"round\" stroke-linecap=\"round\" stroke-width=\".837\" rx=\".646\"/><path d=\"M347.58 536.498c-.051-.618-.55-1.138-1.178-1.138H329.6c-.628 0-1.127.52-1.18 1.138h-.02v15.663a1.2 1.2 0 0 0 1.2 1.2h16.801a1.2 1.2 0 0 0 1.2-1.2v-15.663h-.021M334.4 552.16h-4.8v-3.6h4.8v3.6m0-4.7h-4.8v-3.7h4.8v3.7m0-4.9h-4.8v-3.601h4.8v3.6m6 9.601h-4.8v-3.6h4.8v3.6m0-4.7h-4.8v-3.7h4.8v3.7m0-4.9h-4.8v-3.601h4.8v3.6m6.001 9.601h-4.8v-3.6h4.8v3.6m0-4.7h-4.8v-3.7h4.8v3.7m0-4.9h-4.8v-3.601h4.8v3.6\"/></g></symbol><symbol id=\"trumbowyg-row-above\" viewBox=\"0 0 24 24\"><rect y=\"-347\" x=\"537.06\" height=\"18\" width=\"6\" transform=\"matrix(0 1 1 0 350 -532.36)\" fill=\"#1ab394\" stroke=\"#000\" stroke-linejoin=\"round\" stroke-linecap=\"round\" stroke-width=\".917\" rx=\".776\"/><path d=\"M2.42 4.138C2.47 3.52 2.97 3 3.598 3H20.4c.628 0 1.127.52 1.18 1.138h.02V19.8a1.2 1.2 0 0 1-1.2 1.2H3.599a1.2 1.2 0 0 1-1.2-1.2V4.138h.021M15.6 19.8h4.8v-3.6h-4.8v3.6m0-4.7h4.8v-3.7h-4.8v3.7m0-4.9h4.8V6.6h-4.8v3.6m-6 9.601h4.8v-3.6H9.6v3.6m0-4.7h4.8v-3.7H9.6v3.7m0-4.9h4.8V6.6H9.6v3.6m-6.001 9.601h4.8v-3.6H3.6v3.6m0-4.7h4.8v-3.7H3.6v3.7m0-4.9h4.8V6.6H3.6v3.6\"/></symbol><symbol id=\"trumbowyg-row-below\" viewBox=\"0 0 24 24\"><rect y=\"-347.06\" x=\"548.4\" height=\"18.13\" width=\"4.427\" transform=\"matrix(0 1 1 0 350 -532.36)\" fill=\"#1ab394\" stroke=\"#000\" stroke-linejoin=\"round\" stroke-linecap=\"round\" stroke-width=\".79\" rx=\".781\"/><path d=\"M2.42 4.138C2.47 3.52 2.97 3 3.598 3H20.4c.628 0 1.127.52 1.18 1.138h.02V19.8a1.2 1.2 0 0 1-1.2 1.2H3.599a1.2 1.2 0 0 1-1.2-1.2V4.138h.021M15.6 19.8h4.8v-3.6h-4.8v3.6m0-4.7h4.8v-3.7h-4.8v3.7m0-4.9h4.8V6.6h-4.8v3.6m-6 9.601h4.8v-3.6H9.6v3.6m0-4.7h4.8v-3.7H9.6v3.7m0-4.9h4.8V6.6H9.6v3.6m-6.001 9.601h4.8v-3.6H3.6v3.6m0-4.7h4.8v-3.7H3.6v3.7m0-4.9h4.8V6.6H3.6v3.6\"/></symbol><symbol id=\"trumbowyg-row-delete\" viewBox=\"0 0 24 24\"><rect width=\"5\" height=\"18\" x=\"543.36\" y=\"-347\" transform=\"rotate(90 103.18 -429.18)\" fill=\"#ed5565\" rx=\".776\"/><path d=\"M21.58 4.136c-.051-.618-.55-1.138-1.178-1.138H3.6c-.628 0-1.127.52-1.18 1.138H2.4v15.663A1.2 1.2 0 0 0 3.6 21h16.801a1.2 1.2 0 0 0 1.2-1.2V4.136h-.021M8.4 19.799H3.6v-3.6h4.8v3.6m0-4.7H3.6v-3.7h4.8v3.7m0-4.9H3.6V6.597h4.8v3.6m6 9.601H9.6v-3.6h4.8v3.6m0-4.7H9.6v-3.7h4.8v3.7m0-4.9H9.6V6.597h4.8v3.6m6.001 9.601h-4.8v-3.6h4.8v3.6m0-4.7h-4.8v-3.7h4.8v3.7m0-4.9h-4.8V6.597h4.8v3.6\"/></symbol><symbol id=\"trumbowyg-table-delete\" viewBox=\"0 0 24 24\"><rect y=\"-347\" x=\"537.06\" height=\"18\" width=\"6\" transform=\"matrix(0 1 1 0 350 -532.36)\" fill=\"#ed5565\" stroke=\"#000\" stroke-linejoin=\"round\" stroke-linecap=\"round\" stroke-width=\".917\" rx=\".776\"/><rect width=\"5\" height=\"18\" x=\"543.36\" y=\"-347\" transform=\"rotate(90 103.18 -429.18)\" fill=\"#ed5565\" rx=\".776\"/><rect y=\"-347.06\" x=\"548.4\" height=\"18.13\" width=\"4.427\" transform=\"matrix(0 1 1 0 350 -532.36)\" fill=\"#ed5565\" stroke=\"#000\" stroke-linejoin=\"round\" stroke-linecap=\"round\" stroke-width=\".79\" rx=\".781\"/><path d=\"M21.58 4.136c-.051-.618-.55-1.138-1.178-1.138H3.6c-.628 0-1.127.52-1.18 1.138H2.4v15.663A1.2 1.2 0 0 0 3.6 21h16.801a1.2 1.2 0 0 0 1.2-1.2V4.136h-.021M8.4 19.799H3.6v-3.6h4.8v3.6m0-4.7H3.6v-3.7h4.8v3.7m0-4.9H3.6V6.597h4.8v3.6m6 9.601H9.6v-3.6h4.8v3.6m0-4.7H9.6v-3.7h4.8v3.7m0-4.9H9.6V6.597h4.8v3.6m6.001 9.601h-4.8v-3.6h4.8v3.6m0-4.7h-4.8v-3.7h4.8v3.7m0-4.9h-4.8V6.597h4.8v3.6\"/></symbol><symbol id=\"trumbowyg-upload\" viewBox=\"0 0 72 72\"><path d=\"M64 27v28H8V27H0v36h72V27h-8z\"/><path d=\"M32.1 6.7h8v33.6h-8z\"/><path d=\"M48 35.9L36 49.6 24 36h24z\"/></symbol></svg>");
            System.out.println("write to file success : "+file.getPath());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (bufferedWriter != null) {
                    bufferedWriter.flush();
                    bufferedWriter.close();
                }
                if (fileOutputStream != null) {
                    fileOutputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void writeJsPlusTrumbowygCss(String htmlPath, String serverUrl) {
        File file = null;
        OutputStream fileOutputStream = null;
        BufferedWriter bufferedWriter = null;
        try {
            File folder = new File(htmlPath + "/js/plus");
            folder.mkdirs();
            file = new File(htmlPath + "/js/plus/trumbowyg.css");
            //如果文件不存在，则创建文件
            file.createNewFile();
            fileOutputStream = new FileOutputStream(file);
            bufferedWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream, "utf-8"));
            bufferedWriter.write("#trumbowyg-icons,#trumbowyg-icons svg{height:0;width:0}#trumbowyg-icons{overflow:hidden;visibility:hidden}.trumbowyg-box *,.trumbowyg-box ::after,.trumbowyg-box ::before{box-sizing:border-box}.trumbowyg-box svg{width:17px;height:100%;fill:#222}.trumbowyg-box,.trumbowyg-editor{display:block;position:relative;border:1px solid #DDD;width:100%;min-height:300px;margin:17px auto}.trumbowyg-box .trumbowyg-editor{margin:0 auto}.trumbowyg-box.trumbowyg-fullscreen{background:#FEFEFE;border:none!important}.trumbowyg-editor,.trumbowyg-textarea{position:relative;box-sizing:border-box;padding:20px;min-height:300px;width:100%;border-style:none;resize:none;outline:0;overflow:auto}.trumbowyg-editor.trumbowyg-autogrow-on-enter,.trumbowyg-textarea.trumbowyg-autogrow-on-enter{transition:height .3s ease-out}.trumbowyg-box-blur .trumbowyg-editor *,.trumbowyg-box-blur .trumbowyg-editor::before{color:transparent!important;text-shadow:0 0 7px #333}@media screen and (min-width:0 \\0){.trumbowyg-box-blur .trumbowyg-editor *,.trumbowyg-box-blur .trumbowyg-editor::before{color:rgba(200,200,200,.6)!important}}@supports (-ms-accelerator:true){.trumbowyg-box-blur .trumbowyg-editor *,.trumbowyg-box-blur .trumbowyg-editor::before{color:rgba(200,200,200,.6)!important}}.trumbowyg-box-blur .trumbowyg-editor hr,.trumbowyg-box-blur .trumbowyg-editor img{opacity:.2}.trumbowyg-textarea{position:relative;display:block;overflow:auto;border:none;font-size:14px;font-family:Inconsolata,Consolas,Courier,\"Courier New\",sans-serif;line-height:18px}.trumbowyg-box.trumbowyg-editor-visible .trumbowyg-textarea{height:1px!important;width:25%;min-height:0!important;padding:0!important;background:0 0;opacity:0!important}.trumbowyg-box.trumbowyg-editor-hidden .trumbowyg-textarea{display:block}.trumbowyg-box.trumbowyg-editor-hidden .trumbowyg-editor{display:none}.trumbowyg-box.trumbowyg-disabled .trumbowyg-textarea{opacity:.8;background:0 0}.trumbowyg-editor[contenteditable=true]:empty:not(:focus)::before{content:attr(placeholder);color:#999;pointer-events:none}.trumbowyg-button-pane{width:100%;min-height:36px;background:#ecf0f1;border-bottom:1px solid #d7e0e2;margin:0;padding:0 5px;position:relative;list-style-type:none;line-height:10px;backface-visibility:hidden;z-index:11}.trumbowyg-button-pane::after{content:\" \";display:block;position:absolute;top:36px;left:0;right:0;width:100%;height:1px;background:#d7e0e2}.trumbowyg-button-pane .trumbowyg-button-group{display:inline-block}.trumbowyg-button-pane .trumbowyg-button-group .trumbowyg-fullscreen-button svg{color:transparent}.trumbowyg-button-pane .trumbowyg-button-group::after{content:\" \";display:inline-block;width:1px;background:#d7e0e2;margin:0 5px;height:35px;vertical-align:top}.trumbowyg-button-pane .trumbowyg-button-group:last-child::after{content:none}.trumbowyg-button-pane button{display:inline-block;position:relative;width:35px;height:35px;padding:1px 6px!important;margin-bottom:1px;overflow:hidden;border:none;cursor:pointer;background:0 0;vertical-align:middle;transition:background-color 150ms,opacity 150ms}.trumbowyg-button-pane button.trumbowyg-textual-button{width:auto;line-height:35px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.trumbowyg-button-pane button.trumbowyg-disable,.trumbowyg-button-pane.trumbowyg-disable button:not(.trumbowyg-not-disable):not(.trumbowyg-active),.trumbowyg-disabled .trumbowyg-button-pane button:not(.trumbowyg-not-disable):not(.trumbowyg-viewHTML-button){opacity:.2;cursor:default}.trumbowyg-button-pane.trumbowyg-disable .trumbowyg-button-group::before,.trumbowyg-disabled .trumbowyg-button-pane .trumbowyg-button-group::before{background:#e3e9eb}.trumbowyg-button-pane button.trumbowyg-active,.trumbowyg-button-pane button:not(.trumbowyg-disable):focus,.trumbowyg-button-pane button:not(.trumbowyg-disable):hover{background-color:#FFF;outline:0}.trumbowyg-button-pane .trumbowyg-open-dropdown::after{display:block;content:\" \";position:absolute;top:25px;right:3px;height:0;width:0;border:3px solid transparent;border-top-color:#555}.trumbowyg-button-pane .trumbowyg-open-dropdown.trumbowyg-textual-button{padding-left:10px!important;padding-right:18px!important}.trumbowyg-button-pane .trumbowyg-open-dropdown.trumbowyg-textual-button::after{top:17px;right:7px}.trumbowyg-modal,.trumbowyg-modal-box{top:0;left:50%;transform:translateX(-50%);backface-visibility:hidden;position:absolute}.trumbowyg-button-pane .trumbowyg-right{float:right}.trumbowyg-dropdown{width:200px;border:1px solid #ecf0f1;padding:5px 0;border-top:none;background:#FFF;margin-left:-1px;box-shadow:rgba(0,0,0,.1) 0 2px 3px;z-index:12}.trumbowyg-dropdown button{display:block;width:100%;height:35px;line-height:35px;text-decoration:none;background:#FFF;padding:0 10px;color:#333!important;border:none;cursor:pointer;text-align:left;font-size:15px;transition:all 150ms}.trumbowyg-dropdown button:focus,.trumbowyg-dropdown button:hover{background:#ecf0f1}.trumbowyg-dropdown button svg{float:left;margin-right:14px}.trumbowyg-modal{max-width:520px;width:100%;height:350px;z-index:12;overflow:hidden}.trumbowyg-modal-box{max-width:500px;width:calc(100% - 20px);padding-bottom:45px;z-index:1;background-color:#FFF;text-align:center;font-size:14px;box-shadow:rgba(0,0,0,.2) 0 2px 3px}.trumbowyg-modal-box .trumbowyg-modal-title{font-size:24px;font-weight:700;margin:0 0 20px;padding:15px 0 13px;display:block;border-bottom:1px solid #EEE;color:#333;background:#fbfcfc}.trumbowyg-modal-box .trumbowyg-progress{width:100%;height:3px;position:absolute;top:58px}.trumbowyg-modal-box .trumbowyg-progress .trumbowyg-progress-bar{background:#2BC06A;width:0;height:100%;transition:width 150ms linear}.trumbowyg-modal-box label{display:block;position:relative;margin:15px 12px;height:29px;line-height:29px;overflow:hidden}.trumbowyg-modal-box label .trumbowyg-input-infos{display:block;text-align:left;height:25px;line-height:25px;transition:all 150ms}.trumbowyg-modal-box label .trumbowyg-input-infos span{display:block;color:#69878f;background-color:#fbfcfc;border:1px solid #DEDEDE;padding:0 7px;width:150px}.trumbowyg-modal-box label .trumbowyg-input-infos span.trumbowyg-msg-error{color:#e74c3c}.trumbowyg-modal-box label.trumbowyg-input-error input,.trumbowyg-modal-box label.trumbowyg-input-error textarea{border:1px solid #e74c3c}.trumbowyg-modal-box label.trumbowyg-input-error .trumbowyg-input-infos{margin-top:-27px}.trumbowyg-modal-box label input{position:absolute;top:0;right:0;height:27px;line-height:27px;border:1px solid #DEDEDE;background:#fff;font-size:14px;max-width:330px;width:70%;padding:0 7px;transition:all 150ms}.trumbowyg-modal-box label input:focus,.trumbowyg-modal-box label input:hover{outline:0;border:1px solid #95a5a6}.trumbowyg-modal-box label input:focus{background:#fbfcfc}.trumbowyg-modal-box label input[type=checkbox]{left:5px;top:5px;right:auto}.trumbowyg-modal-box label input[type=checkbox]+.trumbowyg-input-infos span{width:auto;padding-left:25px}.trumbowyg-modal-box .error{margin-top:25px;display:block;color:red}.trumbowyg-modal-box .trumbowyg-modal-button{position:absolute;bottom:10px;right:0;text-decoration:none;color:#FFF;display:block;width:100px;height:35px;line-height:33px;margin:0 10px;background-color:#333;border:none;cursor:pointer;font-family:\"Trebuchet MS\",Helvetica,Verdana,sans-serif;font-size:16px;transition:all 150ms}.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit{right:110px;background:#2bc06a}.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:focus,.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:hover{background:#40d47e;outline:0}.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:active{background:#25a25a}.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset{color:#555;background:#e6e6e6}.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:focus,.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:hover{background:#fbfbfb;outline:0}.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:active{background:#d5d5d5}.trumbowyg-overlay{position:absolute;background-color:rgba(255,255,255,.5);height:100%;width:100%;left:0;display:none;top:0;z-index:10}body.trumbowyg-body-fullscreen{overflow:hidden}.trumbowyg-fullscreen{position:fixed;top:0;left:0;width:100%;height:100%;margin:0;padding:0;z-index:99999}.trumbowyg-fullscreen .trumbowyg-editor,.trumbowyg-fullscreen.trumbowyg-box{border:none}.trumbowyg-fullscreen .trumbowyg-editor,.trumbowyg-fullscreen .trumbowyg-textarea{height:calc(100% - 37px)!important;overflow:auto}.trumbowyg-fullscreen .trumbowyg-overlay{height:100%!important}.trumbowyg-fullscreen .trumbowyg-button-group .trumbowyg-fullscreen-button svg{color:#222;fill:transparent}.trumbowyg-editor embed,.trumbowyg-editor img,.trumbowyg-editor object,.trumbowyg-editor video{max-width:100%}.trumbowyg-editor img,.trumbowyg-editor video{height:auto}.trumbowyg-editor img{cursor:move}.trumbowyg-editor.trumbowyg-reset-css{background:#FEFEFE!important;font-family:\"Trebuchet MS\",Helvetica,Verdana,sans-serif!important;font-size:14px!important;line-height:1.45em!important;color:#333}.trumbowyg-editor.trumbowyg-reset-css a{color:#15c!important;text-decoration:underline!important}.trumbowyg-editor.trumbowyg-reset-css blockquote,.trumbowyg-editor.trumbowyg-reset-css div,.trumbowyg-editor.trumbowyg-reset-css ol,.trumbowyg-editor.trumbowyg-reset-css p,.trumbowyg-editor.trumbowyg-reset-css ul{box-shadow:none!important;background:0 0!important;margin:0 0 15px!important;line-height:1.4em!important;font-family:\"Trebuchet MS\",Helvetica,Verdana,sans-serif!important;font-size:14px!important;border:none}.trumbowyg-editor.trumbowyg-reset-css hr,.trumbowyg-editor.trumbowyg-reset-css iframe,.trumbowyg-editor.trumbowyg-reset-css object{margin-bottom:15px!important}.trumbowyg-editor.trumbowyg-reset-css blockquote{margin-left:32px!important;font-style:italic!important;color:#555}.trumbowyg-editor.trumbowyg-reset-css ul{list-style:disc}.trumbowyg-editor.trumbowyg-reset-css ol,.trumbowyg-editor.trumbowyg-reset-css ul{padding-left:20px!important}.trumbowyg-editor.trumbowyg-reset-css ol ol,.trumbowyg-editor.trumbowyg-reset-css ol ul,.trumbowyg-editor.trumbowyg-reset-css ul ol,.trumbowyg-editor.trumbowyg-reset-css ul ul{border:none;margin:2px!important;padding:0 0 0 24px!important}.trumbowyg-editor.trumbowyg-reset-css hr{display:block;height:1px;border:none;border-top:1px solid #CCC}.trumbowyg-editor.trumbowyg-reset-css h1,.trumbowyg-editor.trumbowyg-reset-css h2,.trumbowyg-editor.trumbowyg-reset-css h3,.trumbowyg-editor.trumbowyg-reset-css h4{color:#111;background:0 0;margin:0!important;padding:0!important;font-weight:700}.trumbowyg-editor.trumbowyg-reset-css h1{font-size:32px!important;line-height:38px!important;margin-bottom:20px!important}.trumbowyg-editor.trumbowyg-reset-css h2{font-size:26px!important;line-height:34px!important;margin-bottom:15px!important}.trumbowyg-editor.trumbowyg-reset-css h3{font-size:22px!important;line-height:28px!important;margin-bottom:7px!important}.trumbowyg-editor.trumbowyg-reset-css h4{font-size:16px!important;line-height:22px!important;margin-bottom:7px!important}.trumbowyg-dark .trumbowyg-textarea{background:#111;color:#ddd}.trumbowyg-dark .trumbowyg-box{border:1px solid #343434}.trumbowyg-dark .trumbowyg-box.trumbowyg-fullscreen{background:#111}.trumbowyg-dark .trumbowyg-box.trumbowyg-box-blur .trumbowyg-editor *,.trumbowyg-dark .trumbowyg-box.trumbowyg-box-blur .trumbowyg-editor::before{text-shadow:0 0 7px #ccc}@media screen and (min-width:0 \\0){.trumbowyg-dark .trumbowyg-box.trumbowyg-box-blur .trumbowyg-editor *,.trumbowyg-dark .trumbowyg-box.trumbowyg-box-blur .trumbowyg-editor::before{color:rgba(20,20,20,.6)!important}}@supports (-ms-accelerator:true){.trumbowyg-dark .trumbowyg-box.trumbowyg-box-blur .trumbowyg-editor *,.trumbowyg-dark .trumbowyg-box.trumbowyg-box-blur .trumbowyg-editor::before{color:rgba(20,20,20,.6)!important}}.trumbowyg-dark .trumbowyg-box svg{fill:#ecf0f1;color:#ecf0f1}.trumbowyg-dark .trumbowyg-button-pane{background-color:#222;border-bottom-color:#343434}.trumbowyg-dark .trumbowyg-button-pane::after{background:#343434}.trumbowyg-dark .trumbowyg-button-pane .trumbowyg-button-group:not(:empty)::after{background-color:#343434}.trumbowyg-dark .trumbowyg-button-pane .trumbowyg-button-group:not(:empty) .trumbowyg-fullscreen-button svg{color:transparent}.trumbowyg-dark .trumbowyg-button-pane.trumbowyg-disable .trumbowyg-button-group::after{background-color:#2a2a2a}.trumbowyg-dark .trumbowyg-button-pane button.trumbowyg-active,.trumbowyg-dark .trumbowyg-button-pane button:not(.trumbowyg-disable):focus,.trumbowyg-dark .trumbowyg-button-pane button:not(.trumbowyg-disable):hover{background-color:#333}.trumbowyg-dark .trumbowyg-button-pane .trumbowyg-open-dropdown::after{border-top-color:#fff}.trumbowyg-dark .trumbowyg-fullscreen .trumbowyg-button-group .trumbowyg-fullscreen-button svg{color:#ecf0f1;fill:transparent}.trumbowyg-dark .trumbowyg-dropdown{border-color:#222;background:#333;box-shadow:rgba(0,0,0,.3) 0 2px 3px}.trumbowyg-dark .trumbowyg-dropdown button{background:#333;color:#fff!important}.trumbowyg-dark .trumbowyg-dropdown button:focus,.trumbowyg-dark .trumbowyg-dropdown button:hover{background:#222}.trumbowyg-dark .trumbowyg-modal-box{background-color:#222}.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-title{border-bottom:1px solid #555;color:#fff;background:#3c3c3c}.trumbowyg-dark .trumbowyg-modal-box label{display:block;position:relative;margin:15px 12px;height:27px;line-height:27px;overflow:hidden}.trumbowyg-dark .trumbowyg-modal-box label .trumbowyg-input-infos span{color:#eee;background-color:#2f2f2f;border-color:#222}.trumbowyg-dark .trumbowyg-modal-box label .trumbowyg-input-infos span.trumbowyg-msg-error{color:#e74c3c}.trumbowyg-dark .trumbowyg-modal-box label.trumbowyg-input-error input,.trumbowyg-dark .trumbowyg-modal-box label.trumbowyg-input-error textarea{border-color:#e74c3c}.trumbowyg-dark .trumbowyg-modal-box label input{border-color:#222;color:#eee;background:#333}.trumbowyg-dark .trumbowyg-modal-box label input:focus,.trumbowyg-dark .trumbowyg-modal-box label input:hover{border-color:#626262}.trumbowyg-dark .trumbowyg-modal-box label input:focus{background-color:#2f2f2f}.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit{background:#1b7943}.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:focus,.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:hover{background:#25a25a}.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:active{background:#176437}.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset{background:#333;color:#ccc}.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:focus,.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:hover{background:#444}.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:active{background:#111}.trumbowyg-dark .trumbowyg-overlay{background-color:rgba(15,15,15,.6)}");
            System.out.println("write to file success : "+file.getPath());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (bufferedWriter != null) {
                    bufferedWriter.flush();
                    bufferedWriter.close();
                }
                if (fileOutputStream != null) {
                    fileOutputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void writeJsPlusTrumbowygJs(String htmlPath, String serverUrl) {
        File file = null;
        OutputStream fileOutputStream = null;
        BufferedWriter bufferedWriter = null;
        try {
            File folder = new File(htmlPath + "/js/plus");
            folder.mkdirs();
            file = new File(htmlPath + "/js/plus/trumbowyg.js");
            //如果文件不存在，则创建文件
            file.createNewFile();
            fileOutputStream = new FileOutputStream(file);
            bufferedWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream, "utf-8"));
            bufferedWriter.write("jQuery.trumbowyg={langs:{en:{viewHTML:\"View HTML\",undo:\"Undo\",redo:\"Redo\",formatting:\"Formatting\",p:\"Paragraph\",blockquote:\"Quote\",code:\"Code\",header:\"Header\",bold:\"Bold\",italic:\"Italic\",strikethrough:\"Stroke\",underline:\"Underline\",strong:\"Strong\",em:\"Emphasis\",del:\"Deleted\",superscript:\"Superscript\",subscript:\"Subscript\",unorderedList:\"Unordered list\",orderedList:\"Ordered list\",insertImage:\"Insert Image\",link:\"Link\",createLink:\"Insert link\",unlink:\"Remove link\",justifyLeft:\"Align Left\",justifyCenter:\"Align Center\",justifyRight:\"Align Right\",justifyFull:\"Align Justify\",horizontalRule:\"Insert horizontal rule\",removeformat:\"Remove format\",fullscreen:\"Fullscreen\",close:\"Close\",submit:\"Confirm\",reset:\"Cancel\",required:\"Required\",description:\"Description\",title:\"Title\",text:\"Text\",target:\"Target\",width:\"Width\"}},plugins:{},svgPath:null,hideButtonTexts:null},Object.defineProperty(jQuery.trumbowyg,\"defaultOptions\",{value:{lang:\"en\",fixedBtnPane:!1,fixedFullWidth:!1,autogrow:!1,autogrowOnEnter:!1,imageWidthModalEdit:!1,prefix:\"trumbowyg-\",semantic:!0,resetCss:!1,removeformatPasted:!1,tagsToRemove:[],btns:[[\"viewHTML\"],[\"undo\",\"redo\"],[\"formatting\"],[\"strong\",\"em\",\"del\"],[\"superscript\",\"subscript\"],[\"link\"],[\"insertImage\"],[\"justifyLeft\",\"justifyCenter\",\"justifyRight\",\"justifyFull\"],[\"unorderedList\",\"orderedList\"],[\"horizontalRule\"],[\"removeformat\"],[\"fullscreen\"]],btnsDef:{},inlineElementsSelector:\"a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u\",pasteHandlers:[],plugins:{},urlProtocol:!1,minimalLinks:!1},writable:!1,enumerable:!0,configurable:!1}),function(e,t,n,a){\"use strict\";var o=\"tbwconfirm\",r=\"tbwcancel\";a.fn.trumbowyg=function(e,t){var n=\"trumbowyg\";if(e===Object(e)||!e)return this.each(function(){a(this).data(n)||a(this).data(n,new i(this,e))});if(1===this.length)try{var o=a(this).data(n);switch(e){case\"execCmd\":return o.execCmd(t.cmd,t.param,t.forceCss);case\"openModal\":return o.openModal(t.title,t.content);case\"closeModal\":return o.closeModal();case\"openModalInsert\":return o.openModalInsert(t.title,t.fields,t.callback);case\"saveRange\":return o.saveRange();case\"getRange\":return o.range;case\"getRangeText\":return o.getRangeText();case\"restoreRange\":return o.restoreRange();case\"enable\":return o.setDisabled(!1);case\"disable\":return o.setDisabled(!0);case\"toggle\":return o.toggle();case\"destroy\":return o.destroy();case\"empty\":return o.empty();case\"html\":return o.html(t)}}catch(r){}return!1};var i=function(o,r){var i=this,s=\"trumbowyg-icons\",l=a.trumbowyg;i.doc=o.ownerDocument||n,i.$ta=a(o),i.$c=a(o),r=r||{},null!=r.lang||null!=l.langs[r.lang]?i.lang=a.extend(!0,{},l.langs.en,l.langs[r.lang]):i.lang=l.langs.en,i.hideButtonTexts=null!=l.hideButtonTexts?l.hideButtonTexts:r.hideButtonTexts;var d=null!=l.svgPath?l.svgPath:r.svgPath;if(i.hasSvg=d!==!1,i.svgPath=i.doc.querySelector(\"base\")?t.location.href.split(\"#\")[0]:\"\",0===a(\"#\"+s,i.doc).length&&d!==!1){if(null==d){for(var c=n.getElementsByTagName(\"script\"),u=0;u<c.length;u+=1){var g=c[u].src,f=g.match(\"trumbowyg(.min)?.js\");null!=f&&(d=g.substring(0,g.indexOf(f[0]))+\"ui/icons.svg\")}null==d&&console.warn(\"You must define svgPath: https://goo.gl/CfTY9U\")}var h=i.doc.createElement(\"div\");h.id=s,i.doc.body.insertBefore(h,i.doc.body.childNodes[0]),a.ajax({async:!0,type:\"GET\",contentType:\"application/x-www-form-urlencoded; charset=UTF-8\",dataType:\"xml\",crossDomain:!0,url:d,data:null,beforeSend:null,complete:null,success:function(e){h.innerHTML=(new XMLSerializer).serializeToString(e.documentElement)}})}var p=i.lang.header,m=function(){return(t.chrome||t.Intl&&Intl.v8BreakIterator)&&\"CSS\"in t};i.btnsDef={viewHTML:{fn:\"toggle\",\"class\":\"trumbowyg-not-disable\"},undo:{isSupported:m,key:\"Z\"},redo:{isSupported:m,key:\"Y\"},p:{fn:\"formatBlock\"},blockquote:{fn:\"formatBlock\"},h1:{fn:\"formatBlock\",title:p+\" 1\"},h2:{fn:\"formatBlock\",title:p+\" 2\"},h3:{fn:\"formatBlock\",title:p+\" 3\"},h4:{fn:\"formatBlock\",title:p+\" 4\"},subscript:{tag:\"sub\"},superscript:{tag:\"sup\"},bold:{key:\"B\",tag:\"b\"},italic:{key:\"I\",tag:\"i\"},underline:{tag:\"u\"},strikethrough:{tag:\"strike\"},strong:{fn:\"bold\",key:\"B\"},em:{fn:\"italic\",key:\"I\"},del:{fn:\"strikethrough\"},createLink:{key:\"K\",tag:\"a\"},unlink:{},insertImage:{},justifyLeft:{tag:\"left\",forceCss:!0},justifyCenter:{tag:\"center\",forceCss:!0},justifyRight:{tag:\"right\",forceCss:!0},justifyFull:{tag:\"justify\",forceCss:!0},unorderedList:{fn:\"insertUnorderedList\",tag:\"ul\"},orderedList:{fn:\"insertOrderedList\",tag:\"ol\"},horizontalRule:{fn:\"insertHorizontalRule\"},removeformat:{},fullscreen:{\"class\":\"trumbowyg-not-disable\"},close:{fn:\"destroy\",\"class\":\"trumbowyg-not-disable\"},formatting:{dropdown:[\"p\",\"blockquote\",\"h1\",\"h2\",\"h3\",\"h4\"],ico:\"p\"},link:{dropdown:[\"createLink\",\"unlink\"]}},i.o=a.extend(!0,{},l.defaultOptions,r),i.o.hasOwnProperty(\"imgDblClickHandler\")||(i.o.imgDblClickHandler=i.getDefaultImgDblClickHandler()),i.urlPrefix=i.setupUrlPrefix(),i.disabled=i.o.disabled||\"TEXTAREA\"===o.nodeName&&o.disabled,r.btns?i.o.btns=r.btns:i.o.semantic||(i.o.btns[3]=[\"bold\",\"italic\",\"underline\",\"strikethrough\"]),a.each(i.o.btnsDef,function(e,t){i.addBtnDef(e,t)}),i.eventNamespace=\"trumbowyg-event\",i.keys=[],i.tagToButton={},i.tagHandlers=[],i.pasteHandlers=[].concat(i.o.pasteHandlers),i.isIE=e.userAgent.indexOf(\"MSIE\")!==-1||e.appVersion.indexOf(\"Trident/\")!==-1,i.init()};i.prototype={DEFAULT_SEMANTIC_MAP:{b:\"strong\",i:\"em\",s:\"del\",strike:\"del\",div:\"p\"},init:function(){var e=this;e.height=e.$ta.height(),e.initPlugins();try{e.doc.execCommand(\"enableObjectResizing\",!1,!1),e.doc.execCommand(\"defaultParagraphSeparator\",!1,\"p\")}catch(t){}e.buildEditor(),e.buildBtnPane(),e.fixedBtnPaneEvents(),e.buildOverlay(),setTimeout(function(){e.disabled&&e.setDisabled(!0),e.$c.trigger(\"tbwinit\")})},addBtnDef:function(e,t){this.btnsDef[e]=t},setupUrlPrefix:function(){var e=this.o.urlProtocol;if(e)return\"string\"!=typeof e?\"https://\":/:\\/\\/$/.test(e)?e:e+\"://\"},buildEditor:function(){var e=this,n=e.o.prefix,o=\"\";e.$box=a(\"<div/>\",{\"class\":n+\"box \"+n+\"editor-visible \"+n+e.o.lang+\" trumbowyg\"}),e.isTextarea=e.$ta.is(\"textarea\"),e.isTextarea?(o=e.$ta.val(),e.$ed=a(\"<div/>\"),e.$box.insertAfter(e.$ta).append(e.$ed,e.$ta)):(e.$ed=e.$ta,o=e.$ed.html(),e.$ta=a(\"<textarea/>\",{name:e.$ta.attr(\"id\"),height:e.height}).val(o),e.$box.insertAfter(e.$ed).append(e.$ta,e.$ed),e.syncCode()),e.$ta.addClass(n+\"textarea\").attr(\"tabindex\",-1),e.$ed.addClass(n+\"editor\").attr({contenteditable:!0,dir:e.lang._dir||\"ltr\"}).html(o),e.o.tabindex&&e.$ed.attr(\"tabindex\",e.o.tabindex),e.$c.is(\"[placeholder]\")&&e.$ed.attr(\"placeholder\",e.$c.attr(\"placeholder\")),e.$c.is(\"[spellcheck]\")&&e.$ed.attr(\"spellcheck\",e.$c.attr(\"spellcheck\")),e.o.resetCss&&e.$ed.addClass(n+\"reset-css\"),e.o.autogrow||e.$ta.add(e.$ed).css({height:e.height}),e.semanticCode(),e.o.autogrowOnEnter&&e.$ed.addClass(n+\"autogrow-on-enter\");var r,i=!1,s=!1,l=\"keyup\";e.$ed.on(\"dblclick\",\"img\",e.o.imgDblClickHandler).on(\"keydown\",function(t){if((t.ctrlKey||t.metaKey)&&!t.altKey){i=!0;var n=e.keys[String.fromCharCode(t.which).toUpperCase()];try{return e.execCmd(n.fn,n.param),!1}catch(a){}}}).on(\"compositionstart compositionupdate\",function(){s=!0}).on(l+\" compositionend\",function(t){if(\"compositionend\"===t.type)s=!1;else if(s)return;var n=t.which;if(!(n>=37&&n<=40)){if(!t.ctrlKey&&!t.metaKey||89!==n&&90!==n)if(i||17===n)\"undefined\"==typeof t.which&&e.semanticCode(!1,!1,!0);else{var a=!e.isIE||\"compositionend\"===t.type;e.semanticCode(!1,a&&13===n),e.$c.trigger(\"tbwchange\")}else e.$c.trigger(\"tbwchange\");setTimeout(function(){i=!1},50)}}).on(\"mouseup keydown keyup\",function(t){(!t.ctrlKey&&!t.metaKey||t.altKey)&&setTimeout(function(){i=!1},50),clearTimeout(r),r=setTimeout(function(){e.updateButtonPaneStatus()},50)}).on(\"focus blur\",function(t){if(e.$c.trigger(\"tbw\"+t.type),\"blur\"===t.type&&a(\".\"+n+\"active-button\",e.$btnPane).removeClass(n+\"active-button \"+n+\"active\"),e.o.autogrowOnEnter){if(e.autogrowOnEnterDontClose)return;\"focus\"===t.type?(e.autogrowOnEnterWasFocused=!0,e.autogrowEditorOnEnter()):e.o.autogrow||(e.$ed.css({height:e.$ed.css(\"min-height\")}),e.$c.trigger(\"tbwresize\"))}}).on(\"cut\",function(){setTimeout(function(){e.semanticCode(!1,!0),e.$c.trigger(\"tbwchange\")},0)}).on(\"paste\",function(n){if(e.o.removeformatPasted){n.preventDefault(),t.getSelection&&t.getSelection().deleteFromDocument&&t.getSelection().deleteFromDocument();try{var o=t.clipboardData.getData(\"Text\");try{e.doc.selection.createRange().pasteHTML(o)}catch(r){e.doc.getSelection().getRangeAt(0).insertNode(e.doc.createTextNode(o))}e.$c.trigger(\"tbwchange\",n)}catch(i){e.execCmd(\"insertText\",(n.originalEvent||n).clipboardData.getData(\"text/plain\"))}}a.each(e.pasteHandlers,function(e,t){t(n)}),setTimeout(function(){e.semanticCode(!1,!0),e.$c.trigger(\"tbwpaste\",n)},0)}),e.$ta.on(\"keyup\",function(){e.$c.trigger(\"tbwchange\")}).on(\"paste\",function(){setTimeout(function(){e.$c.trigger(\"tbwchange\")},0)}),e.$box.on(\"keydown\",function(t){if(27===t.which&&1===a(\".\"+n+\"modal-box\",e.$box).length)return e.closeModal(),!1})},autogrowEditorOnEnter:function(){var e=this;e.$ed.removeClass(\"autogrow-on-enter\");var t=e.$ed[0].clientHeight;e.$ed.height(\"auto\");var n=e.$ed[0].scrollHeight;e.$ed.addClass(\"autogrow-on-enter\"),t!==n&&(e.$ed.height(t),setTimeout(function(){e.$ed.css({height:n}),e.$c.trigger(\"tbwresize\")},0))},buildBtnPane:function(){var e=this,t=e.o.prefix,n=e.$btnPane=a(\"<div/>\",{\"class\":t+\"button-pane\"});a.each(e.o.btns,function(o,r){a.isArray(r)||(r=[r]);var i=a(\"<div/>\",{\"class\":t+\"button-group \"+(r.indexOf(\"fullscreen\")>=0?t+\"right\":\"\")});a.each(r,function(t,n){try{e.isSupportedBtn(n)&&i.append(e.buildBtn(n))}catch(a){}}),i.html().trim().length>0&&n.append(i)}),e.$box.prepend(n)},buildBtn:function(e){var t=this,n=t.o.prefix,o=t.btnsDef[e],r=o.dropdown,i=null==o.hasIcon||o.hasIcon,s=t.lang[e]||e,l=a(\"<button/>\",{type:\"button\",\"class\":n+e+\"-button \"+(o[\"class\"]||\"\")+(i?\"\":\" \"+n+\"textual-button\"),html:t.hasSvg&&i?'<svg><use xlink:href=\"'+t.svgPath+\"#\"+n+(o.ico||e).replace(/([A-Z]+)/g,\"-$1\").toLowerCase()+'\"/></svg>':t.hideButtonTexts?\"\":o.text||o.title||t.lang[e]||e,title:(o.title||o.text||s)+(o.key?\" (Ctrl + \"+o.key+\")\":\"\"),tabindex:-1,mousedown:function(){return r&&!a(\".\"+e+\"-\"+n+\"dropdown\",t.$box).is(\":hidden\")||a(\"body\",t.doc).trigger(\"mousedown\"),!((t.$btnPane.hasClass(n+\"disable\")||t.$box.hasClass(n+\"disabled\"))&&!a(this).hasClass(n+\"active\")&&!a(this).hasClass(n+\"not-disable\"))&&(t.execCmd(!!r&&\"dropdown\"||o.fn||e,o.param||e,o.forceCss),!1)}});if(r){l.addClass(n+\"open-dropdown\");var d=n+\"dropdown\",c={\"class\":d+\"-\"+e+\" \"+d+\" \"+n+\"fixed-top\"};c[\"data-\"+d]=e;var u=a(\"<div/>\",c);a.each(r,function(e,n){t.btnsDef[n]&&t.isSupportedBtn(n)&&u.append(t.buildSubBtn(n))}),t.$box.append(u.hide())}else o.key&&(t.keys[o.key]={fn:o.fn||e,param:o.param||e});return r||(t.tagToButton[(o.tag||e).toLowerCase()]=e),l},buildSubBtn:function(e){var t=this,n=t.o.prefix,o=t.btnsDef[e],r=null==o.hasIcon||o.hasIcon;return o.key&&(t.keys[o.key]={fn:o.fn||e,param:o.param||e}),t.tagToButton[(o.tag||e).toLowerCase()]=e,a(\"<button/>\",{type:\"button\",\"class\":n+e+\"-dropdown-button\"+(o.ico?\" \"+n+o.ico+\"-button\":\"\"),html:t.hasSvg&&r?'<svg><use xlink:href=\"'+t.svgPath+\"#\"+n+(o.ico||e).replace(/([A-Z]+)/g,\"-$1\").toLowerCase()+'\"/></svg>'+(o.text||o.title||t.lang[e]||e):o.text||o.title||t.lang[e]||e,title:o.key?\" (Ctrl + \"+o.key+\")\":null,style:o.style||null,mousedown:function(){return a(\"body\",t.doc).trigger(\"mousedown\"),t.execCmd(o.fn||e,o.param||e,o.forceCss),!1}})},isSupportedBtn:function(e){try{return this.btnsDef[e].isSupported()}catch(t){}return!0},buildOverlay:function(){var e=this;return e.$overlay=a(\"<div/>\",{\"class\":e.o.prefix+\"overlay\"}).appendTo(e.$box),e.$overlay},showOverlay:function(){var e=this;a(t).trigger(\"scroll\"),e.$overlay.fadeIn(200),e.$box.addClass(e.o.prefix+\"box-blur\")},hideOverlay:function(){var e=this;e.$overlay.fadeOut(50),e.$box.removeClass(e.o.prefix+\"box-blur\")},fixedBtnPaneEvents:function(){var e=this,n=e.o.fixedFullWidth,o=e.$box;e.o.fixedBtnPane&&(e.isFixed=!1,a(t).on(\"scroll.\"+e.eventNamespace+\" resize.\"+e.eventNamespace,function(){if(o){e.syncCode();var r=a(t).scrollTop(),i=o.offset().top+1,s=e.$btnPane,l=s.outerHeight()-2;r-i>0&&r-i-e.height<0?(e.isFixed||(e.isFixed=!0,s.css({position:\"fixed\",top:0,left:n?\"0\":\"auto\",zIndex:7}),a([e.$ta,e.$ed]).css({marginTop:s.height()})),s.css({width:n?\"100%\":o.width()-1+\"px\"}),a(\".\"+e.o.prefix+\"fixed-top\",o).css({position:n?\"fixed\":\"absolute\",top:n?l:l+(r-i)+\"px\",zIndex:15})):e.isFixed&&(e.isFixed=!1,s.removeAttr(\"style\"),a([e.$ta,e.$ed]).css({marginTop:0}),a(\".\"+e.o.prefix+\"fixed-top\",o).css({position:\"absolute\",top:l}))}}))},setDisabled:function(e){var t=this,n=t.o.prefix;t.disabled=e,e?t.$ta.attr(\"disabled\",!0):t.$ta.removeAttr(\"disabled\"),t.$box.toggleClass(n+\"disabled\",e),t.$ed.attr(\"contenteditable\",!e)},destroy:function(){var e=this,n=e.o.prefix;e.isTextarea?e.$box.after(e.$ta.css({height:\"\"}).val(e.html()).removeClass(n+\"textarea\").show()):e.$box.after(e.$ed.css({height:\"\"}).removeClass(n+\"editor\").removeAttr(\"contenteditable\").removeAttr(\"dir\").html(e.html()).show()),e.$ed.off(\"dblclick\",\"img\"),e.destroyPlugins(),e.$box.remove(),e.$c.removeData(\"trumbowyg\"),a(\"body\").removeClass(n+\"body-fullscreen\"),e.$c.trigger(\"tbwclose\"),a(t).off(\"scroll.\"+e.eventNamespace+\" resize.\"+e.eventNamespace)},empty:function(){this.$ta.val(\"\"),this.syncCode(!0)},toggle:function(){var e=this,t=e.o.prefix;e.o.autogrowOnEnter&&(e.autogrowOnEnterDontClose=!e.$box.hasClass(t+\"editor-hidden\")),e.semanticCode(!1,!0),setTimeout(function(){e.doc.activeElement.blur(),e.$box.toggleClass(t+\"editor-hidden \"+t+\"editor-visible\"),e.$btnPane.toggleClass(t+\"disable\"),a(\".\"+t+\"viewHTML-button\",e.$btnPane).toggleClass(t+\"active\"),e.$box.hasClass(t+\"editor-visible\")?e.$ta.attr(\"tabindex\",-1):e.$ta.removeAttr(\"tabindex\"),e.o.autogrowOnEnter&&!e.autogrowOnEnterDontClose&&e.autogrowEditorOnEnter()},0)},dropdown:function(e){var n=this,o=n.doc,r=n.o.prefix,i=a(\"[data-\"+r+\"dropdown=\"+e+\"]\",n.$box),s=a(\".\"+r+e+\"-button\",n.$btnPane),l=i.is(\":hidden\");if(a(\"body\",o).trigger(\"mousedown\"),l){var d=s.offset().left;s.addClass(r+\"active\"),i.css({position:\"absolute\",top:s.offset().top-n.$btnPane.offset().top+s.outerHeight(),left:n.o.fixedFullWidth&&n.isFixed?d+\"px\":d-n.$btnPane.offset().left+\"px\"}).show(),a(t).trigger(\"scroll\"),a(\"body\",o).on(\"mousedown.\"+n.eventNamespace,function(e){i.is(e.target)||(a(\".\"+r+\"dropdown\",n.$box).hide(),a(\".\"+r+\"active\",n.$btnPane).removeClass(r+\"active\"),a(\"body\",o).off(\"mousedown.\"+n.eventNamespace))})}},html:function(e){var t=this;return null!=e?(t.$ta.val(e),t.syncCode(!0),t.$c.trigger(\"tbwchange\"),t):t.$ta.val()},syncTextarea:function(){var e=this;e.$ta.val(e.$ed.text().trim().length>0||e.$ed.find(\"hr,img,embed,iframe,input\").length>0?e.$ed.html():\"\")},syncCode:function(e){var t=this;if(!e&&t.$ed.is(\":visible\"))t.syncTextarea();else{var n=a(\"<div>\").html(t.$ta.val()),o=a(\"<div>\").append(n);a(t.o.tagsToRemove.join(\",\"),o).remove(),t.$ed.html(o.contents().html())}if(t.o.autogrow&&(t.height=t.$ed.height(),t.height!==t.$ta.css(\"height\")&&(t.$ta.css({height:t.height}),t.$c.trigger(\"tbwresize\"))),t.o.autogrowOnEnter){t.$ed.height(\"auto\");var r=t.autogrowOnEnterWasFocused?t.$ed[0].scrollHeight:t.$ed.css(\"min-height\");r!==t.$ta.css(\"height\")&&(t.$ed.css({height:r}),t.$c.trigger(\"tbwresize\"))}},semanticCode:function(e,t,n){var o=this;if(o.saveRange(),o.syncCode(e),o.o.semantic){if(o.semanticTag(\"b\"),o.semanticTag(\"i\"),o.semanticTag(\"s\"),o.semanticTag(\"strike\"),t){var r=o.o.inlineElementsSelector,i=\":not(\"+r+\")\";o.$ed.contents().filter(function(){return 3===this.nodeType&&this.nodeValue.trim().length>0}).wrap(\"<span data-tbw/>\");var s=function(e){if(0!==e.length){var t=e.nextUntil(i).addBack().wrapAll(\"<p/>\").parent(),n=t.nextAll(r).first();t.next(\"br\").remove(),s(n)}};s(o.$ed.children(r).first()),o.semanticTag(\"div\",!0),o.$ed.find(\"p\").filter(function(){return(!o.range||this!==o.range.startContainer)&&(0===a(this).text().trim().length&&0===a(this).children().not(\"br,span\").length)}).contents().unwrap(),a(\"[data-tbw]\",o.$ed).contents().unwrap(),o.$ed.find(\"p:empty\").remove()}n||o.restoreRange(),o.syncTextarea()}},semanticTag:function(e,t){var n;if(null!=this.o.semantic&&\"object\"==typeof this.o.semantic&&this.o.semantic.hasOwnProperty(e))n=this.o.semantic[e];else{if(this.o.semantic!==!0||!this.DEFAULT_SEMANTIC_MAP.hasOwnProperty(e))return;n=this.DEFAULT_SEMANTIC_MAP[e]}a(e,this.$ed).each(function(){var e=a(this);e.wrap(\"<\"+n+\"/>\"),t&&a.each(e.prop(\"attributes\"),function(){e.parent().attr(this.name,this.value)}),e.contents().unwrap()})},createLink:function(){for(var e,t,n,o=this,r=o.doc.getSelection(),i=r.focusNode,s=(new XMLSerializer).serializeToString(r.getRangeAt(0).cloneContents());[\"A\",\"DIV\"].indexOf(i.nodeName)<0;)i=i.parentNode;if(i&&\"A\"===i.nodeName){var l=a(i);s=l.text(),e=l.attr(\"href\"),o.o.minimalLinks||(t=l.attr(\"title\"),n=l.attr(\"target\"));var d=o.doc.createRange();d.selectNode(i),r.removeAllRanges(),r.addRange(d)}o.saveRange();var c={url:{label:\"URL\",required:!0,value:e},text:{label:o.lang.text,value:s}};o.o.minimalLinks||Object.assign(c,{title:{label:o.lang.title,value:t},target:{label:o.lang.target,value:n}}),o.openModalInsert(o.lang.createLink,c,function(e){var t=o.prependUrlPrefix(e.url);if(!t.length)return!1;var n=a(['<a href=\"',t,'\">',e.text||e.url,\"</a>\"].join(\"\"));return o.o.minimalLinks||(e.title.length>0&&n.attr(\"title\",e.title),e.target.length>0&&n.attr(\"target\",e.target)),o.range.deleteContents(),o.range.insertNode(n[0]),o.syncCode(),o.$c.trigger(\"tbwchange\"),!0})},prependUrlPrefix:function(e){var t=this;if(!t.urlPrefix)return e;var n=/^([a-z][-+.a-z0-9]*:|\\/|#)/i;if(n.test(e))return e;var a=/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;return a.test(e)?\"mailto:\"+e:t.urlPrefix+e},unlink:function(){var e=this,t=e.doc.getSelection(),n=t.focusNode;if(t.isCollapsed){for(;[\"A\",\"DIV\"].indexOf(n.nodeName)<0;)n=n.parentNode;if(n&&\"A\"===n.nodeName){var a=e.doc.createRange();a.selectNode(n),t.removeAllRanges(),t.addRange(a)}}e.execCmd(\"unlink\",void 0,void 0,!0)},insertImage:function(){var e=this;e.saveRange();var t={url:{label:\"URL\",required:!0},alt:{label:e.lang.description,value:e.getRangeText()}};e.o.imageWidthModalEdit&&(t.width={}),e.openModalInsert(e.lang.insertImage,t,function(t){e.execCmd(\"insertImage\",t.url);var n=a('img[src=\"'+t.url+'\"]:not([alt])',e.$box);return n.attr(\"alt\",t.alt),e.o.imageWidthModalEdit&&n.attr({width:t.width}),e.syncCode(),e.$c.trigger(\"tbwchange\"),!0})},fullscreen:function(){var e,n=this,o=n.o.prefix,r=o+\"fullscreen\";n.$box.toggleClass(r),e=n.$box.hasClass(r),a(\"body\").toggleClass(o+\"body-fullscreen\",e),a(t).trigger(\"scroll\"),n.$c.trigger(\"tbw\"+(e?\"open\":\"close\")+\"fullscreen\")},execCmd:function(e,t,n,a){var o=this;a=!!a||\"\",\"dropdown\"!==e&&o.$ed.focus();try{o.doc.execCommand(\"styleWithCSS\",!1,n||!1)}catch(r){}try{o[e+a](t)}catch(r){try{e(t)}catch(i){\"insertHorizontalRule\"===e?t=void 0:\"formatBlock\"===e&&o.isIE&&(t=\"<\"+t+\">\"),o.doc.execCommand(e,!1,t),o.syncCode(),o.semanticCode(!1,!0)}\"dropdown\"!==e&&(o.updateButtonPaneStatus(),o.$c.trigger(\"tbwchange\"))}},openModal:function(e,n){var i=this,s=i.o.prefix;if(a(\".\"+s+\"modal-box\",i.$box).length>0)return!1;i.o.autogrowOnEnter&&(i.autogrowOnEnterDontClose=!0),i.saveRange(),i.showOverlay(),i.$btnPane.addClass(s+\"disable\");var l=a(\"<div/>\",{\"class\":s+\"modal \"+s+\"fixed-top\"}).css({top:i.$btnPane.height()}).appendTo(i.$box);i.$overlay.one(\"click\",function(){return l.trigger(r),!1});var d=a(\"<form/>\",{action:\"\",html:n}).on(\"submit\",function(){return l.trigger(o),!1}).on(\"reset\",function(){return l.trigger(r),!1}).on(\"submit reset\",function(){i.o.autogrowOnEnter&&(i.autogrowOnEnterDontClose=!1)}),c=a(\"<div/>\",{\"class\":s+\"modal-box\",html:d}).css({top:\"-\"+i.$btnPane.outerHeight()+\"px\",opacity:0}).appendTo(l).animate({top:0,opacity:1},100);return a(\"<span/>\",{text:e,\"class\":s+\"modal-title\"}).prependTo(c),l.height(c.outerHeight()+10),a(\"input:first\",c).focus(),i.buildModalBtn(\"submit\",c),i.buildModalBtn(\"reset\",c),a(t).trigger(\"scroll\"),l},buildModalBtn:function(e,t){var n=this,o=n.o.prefix;return a(\"<button/>\",{\"class\":o+\"modal-button \"+o+\"modal-\"+e,type:e,text:n.lang[e]||e}).appendTo(a(\"form\",t))},closeModal:function(){var e=this,t=e.o.prefix;e.$btnPane.removeClass(t+\"disable\"),e.$overlay.off();var n=a(\".\"+t+\"modal-box\",e.$box);n.animate({top:\"-\"+n.height()},100,function(){n.parent().remove(),e.hideOverlay()}),e.restoreRange()},openModalInsert:function(e,t,n){var i=this,s=i.o.prefix,l=i.lang,d=\"\";return a.each(t,function(e,t){var n=t.label||e,a=t.name||e,o=t.attributes||{},r=Object.keys(o).map(function(e){return e+'=\"'+o[e]+'\"'}).join(\" \");d+='<label><input type=\"'+(t.type||\"text\")+'\" name=\"'+a+'\"'+(\"checkbox\"===t.type&&t.value?' checked=\"checked\"':' value=\"'+(t.value||\"\").replace(/\"/g,\"&quot;\"))+'\"'+r+'><span class=\"'+s+'input-infos\"><span>'+(l[n]?l[n]:n)+\"</span></span></label>\"}),i.openModal(e,d).on(o,function(){var e=a(\"form\",a(this)),r=!0,s={};a.each(t,function(t,n){var o=n.name||t,l=a('input[name=\"'+o+'\"]',e),d=l.attr(\"type\");switch(d.toLowerCase()){case\"checkbox\":s[o]=l.is(\":checked\");break;case\"radio\":s[o]=l.filter(\":checked\").val();break;default:s[o]=a.trim(l.val())}n.required&&\"\"===s[o]?(r=!1,i.addErrorOnModalField(l,i.lang.required)):n.pattern&&!n.pattern.test(s[o])&&(r=!1,i.addErrorOnModalField(l,n.patternError))}),r&&(i.restoreRange(),n(s,t)&&(i.syncCode(),i.$c.trigger(\"tbwchange\"),i.closeModal(),a(this).off(o)))}).one(r,function(){a(this).off(o),i.closeModal()})},addErrorOnModalField:function(e,t){var n=this.o.prefix,o=e.parent();e.on(\"change keyup\",function(){o.removeClass(n+\"input-error\")}),o.addClass(n+\"input-error\").find(\"input+span\").append(a(\"<span/>\",{\"class\":n+\"msg-error\",text:t}))},getDefaultImgDblClickHandler:function(){var e=this;return function(){var t=a(this),n=t.attr(\"src\"),o=\"(Base64)\";0===n.indexOf(\"data:image\")&&(n=o);var r={url:{label:\"URL\",value:n,required:!0},alt:{label:e.lang.description,value:t.attr(\"alt\")}};return e.o.imageWidthModalEdit&&(r.width={value:t.attr(\"width\")?t.attr(\"width\"):\"\"}),e.openModalInsert(e.lang.insertImage,r,function(n){return n.url!==o&&t.attr({src:n.url}),t.attr({alt:n.alt}),e.o.imageWidthModalEdit&&(parseInt(n.width)>0?t.attr({width:n.width}):t.removeAttr(\"width\")),!0}),!1}},saveRange:function(){var e=this,t=e.doc.getSelection();if(e.range=null,t.rangeCount){var n,a=e.range=t.getRangeAt(0),o=e.doc.createRange();o.selectNodeContents(e.$ed[0]),o.setEnd(a.startContainer,a.startOffset),n=(o+\"\").length,e.metaRange={start:n,end:n+(a+\"\").length}}},restoreRange:function(){var e,t=this,n=t.metaRange,a=t.range,o=t.doc.getSelection();if(a){if(n&&n.start!==n.end){var r,i=0,s=[t.$ed[0]],l=!1,d=!1;for(e=t.doc.createRange();!d&&(r=s.pop());)if(3===r.nodeType){var c=i+r.length;!l&&n.start>=i&&n.start<=c&&(e.setStart(r,n.start-i),l=!0),l&&n.end>=i&&n.end<=c&&(e.setEnd(r,n.end-i),d=!0),i=c}else for(var u=r.childNodes,g=u.length;g>0;)g-=1,s.push(u[g])}o.removeAllRanges(),o.addRange(e||a)}},getRangeText:function(){return this.range+\"\"},updateButtonPaneStatus:function(){var e=this,t=e.o.prefix,n=e.getTagsRecursive(e.doc.getSelection().focusNode),o=t+\"active-button \"+t+\"active\";a(\".\"+t+\"active-button\",e.$btnPane).removeClass(o),a.each(n,function(n,r){var i=e.tagToButton[r.toLowerCase()],s=a(\".\"+t+i+\"-button\",e.$btnPane);if(s.length>0)s.addClass(o);else try{s=a(\".\"+t+\"dropdown .\"+t+i+\"-dropdown-button\",e.$box);var l=s.parent().data(\"dropdown\");a(\".\"+t+l+\"-button\",e.$box).addClass(o)}catch(d){}})},getTagsRecursive:function(e,t){var n=this;if(t=t||(e&&e.tagName?[e.tagName]:[]),!e||!e.parentNode)return t;e=e.parentNode;var o=e.tagName;return\"DIV\"===o?t:(\"P\"===o&&\"\"!==e.style.textAlign&&t.push(e.style.textAlign),a.each(n.tagHandlers,function(a,o){t=t.concat(o(e,n))}),t.push(o),n.getTagsRecursive(e,t).filter(function(e){return null!=e}))},initPlugins:function(){var e=this;e.loadedPlugins=[],a.each(a.trumbowyg.plugins,function(t,n){n.shouldInit&&!n.shouldInit(e)||(n.init(e),n.tagHandler&&e.tagHandlers.push(n.tagHandler),e.loadedPlugins.push(n))})},destroyPlugins:function(){a.each(this.loadedPlugins,function(e,t){t.destroy&&t.destroy()})}}}(navigator,window,document,jQuery);");
            System.out.println("write to file success : "+file.getPath());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (bufferedWriter != null) {
                    bufferedWriter.flush();
                    bufferedWriter.close();
                }
                if (fileOutputStream != null) {
                    fileOutputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void writeJsCommonServerJs(String htmlPath, String serverUrl, String tokenErrorStatus) {
        if (serverUrl == null) {
            serverUrl = "http://localhost:8080/";
        }
        File file = null;
        OutputStream fileOutputStream = null;
        BufferedWriter bufferedWriter = null;
        try {
            File folder = new File(htmlPath + "/js/common");
            folder.mkdirs();
            file = new File(htmlPath + "/js/common/server.js");
            //如果文件不存在，则创建文件
            file.createNewFile();
            fileOutputStream = new FileOutputStream(file);
            bufferedWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream, "utf-8"));
            bufferedWriter.write("var SERVER_URL='" + serverUrl + "';\n");
            bufferedWriter.write("var validResForIndex = function(res){\nif(res.status==" + tokenErrorStatus + "){\nalert(res.message);\ngotoLoginForIndex();\n}else{\nalert(res.message);\n}\n}\n" +
                    "var validResForContent = function(res){\nif(res.status==" + tokenErrorStatus + "){\nalert(res.message);\ngotoLoginForContent();\n}else{\nalert(res.message);\n}\n}\n" +
                    "var timestampToTime = function (timestamp) {\n" +
                    "    var date = new Date(timestamp);\n" +
                    "    Y = date.getFullYear() + '-';\n" +
                    "    M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';\n" +
                    "    D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';\n" +
                    "    h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';\n" +
                    "    m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';\n" +
                    "    s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());\n" +
                    "    return Y + M + D + h + m + s;\n" +
                    "}\n\n" +
                    "var gotoLoginForIndex=function(){\ntop.location.href='login.html';\nlocation.href='login.html';\n}\n" +
                    "var gotoLoginForContent=function(){\ntop.location.href='../login.html';\nlocation.href='../login.html';\n}\n" +
                    "\n");
            System.out.println("write to file success : " + file.getPath());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (bufferedWriter != null) {
                    bufferedWriter.flush();
                    bufferedWriter.close();
                }
                if (fileOutputStream != null) {
                    fileOutputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void writeJsCommonMd5Js(String htmlPath, String serverUrl) {
        File file = null;
        OutputStream fileOutputStream = null;
        BufferedWriter bufferedWriter = null;
        try {
            File folder = new File(htmlPath + "/js/common");
            folder.mkdirs();
            file = new File(htmlPath + "/js/common/md5.js");
            //如果文件不存在，则创建文件
            file.createNewFile();
            fileOutputStream = new FileOutputStream(file);
            bufferedWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream, "utf-8"));
            bufferedWriter.write("!function(a){\"use strict\";function b(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}function c(a,b){return a<<b|a>>>32-b}function d(a,d,e,f,g,h){return b(c(b(b(d,a),b(f,h)),g),e)}function e(a,b,c,e,f,g,h){return d(b&c|~b&e,a,b,f,g,h)}function f(a,b,c,e,f,g,h){return d(b&e|c&~e,a,b,f,g,h)}function g(a,b,c,e,f,g,h){return d(b^c^e,a,b,f,g,h)}function h(a,b,c,e,f,g,h){return d(c^(b|~e),a,b,f,g,h)}function i(a,c){a[c>>5]|=128<<c%32,a[(c+64>>>9<<4)+14]=c;var d,i,j,k,l,m=1732584193,n=-271733879,o=-1732584194,p=271733878;for(d=0;d<a.length;d+=16)i=m,j=n,k=o,l=p,m=e(m,n,o,p,a[d],7,-680876936),p=e(p,m,n,o,a[d+1],12,-389564586),o=e(o,p,m,n,a[d+2],17,606105819),n=e(n,o,p,m,a[d+3],22,-1044525330),m=e(m,n,o,p,a[d+4],7,-176418897),p=e(p,m,n,o,a[d+5],12,1200080426),o=e(o,p,m,n,a[d+6],17,-1473231341),n=e(n,o,p,m,a[d+7],22,-45705983),m=e(m,n,o,p,a[d+8],7,1770035416),p=e(p,m,n,o,a[d+9],12,-1958414417),o=e(o,p,m,n,a[d+10],17,-42063),n=e(n,o,p,m,a[d+11],22,-1990404162),m=e(m,n,o,p,a[d+12],7,1804603682),p=e(p,m,n,o,a[d+13],12,-40341101),o=e(o,p,m,n,a[d+14],17,-1502002290),n=e(n,o,p,m,a[d+15],22,1236535329),m=f(m,n,o,p,a[d+1],5,-165796510),p=f(p,m,n,o,a[d+6],9,-1069501632),o=f(o,p,m,n,a[d+11],14,643717713),n=f(n,o,p,m,a[d],20,-373897302),m=f(m,n,o,p,a[d+5],5,-701558691),p=f(p,m,n,o,a[d+10],9,38016083),o=f(o,p,m,n,a[d+15],14,-660478335),n=f(n,o,p,m,a[d+4],20,-405537848),m=f(m,n,o,p,a[d+9],5,568446438),p=f(p,m,n,o,a[d+14],9,-1019803690),o=f(o,p,m,n,a[d+3],14,-187363961),n=f(n,o,p,m,a[d+8],20,1163531501),m=f(m,n,o,p,a[d+13],5,-1444681467),p=f(p,m,n,o,a[d+2],9,-51403784),o=f(o,p,m,n,a[d+7],14,1735328473),n=f(n,o,p,m,a[d+12],20,-1926607734),m=g(m,n,o,p,a[d+5],4,-378558),p=g(p,m,n,o,a[d+8],11,-2022574463),o=g(o,p,m,n,a[d+11],16,1839030562),n=g(n,o,p,m,a[d+14],23,-35309556),m=g(m,n,o,p,a[d+1],4,-1530992060),p=g(p,m,n,o,a[d+4],11,1272893353),o=g(o,p,m,n,a[d+7],16,-155497632),n=g(n,o,p,m,a[d+10],23,-1094730640),m=g(m,n,o,p,a[d+13],4,681279174),p=g(p,m,n,o,a[d],11,-358537222),o=g(o,p,m,n,a[d+3],16,-722521979),n=g(n,o,p,m,a[d+6],23,76029189),m=g(m,n,o,p,a[d+9],4,-640364487),p=g(p,m,n,o,a[d+12],11,-421815835),o=g(o,p,m,n,a[d+15],16,530742520),n=g(n,o,p,m,a[d+2],23,-995338651),m=h(m,n,o,p,a[d],6,-198630844),p=h(p,m,n,o,a[d+7],10,1126891415),o=h(o,p,m,n,a[d+14],15,-1416354905),n=h(n,o,p,m,a[d+5],21,-57434055),m=h(m,n,o,p,a[d+12],6,1700485571),p=h(p,m,n,o,a[d+3],10,-1894986606),o=h(o,p,m,n,a[d+10],15,-1051523),n=h(n,o,p,m,a[d+1],21,-2054922799),m=h(m,n,o,p,a[d+8],6,1873313359),p=h(p,m,n,o,a[d+15],10,-30611744),o=h(o,p,m,n,a[d+6],15,-1560198380),n=h(n,o,p,m,a[d+13],21,1309151649),m=h(m,n,o,p,a[d+4],6,-145523070),p=h(p,m,n,o,a[d+11],10,-1120210379),o=h(o,p,m,n,a[d+2],15,718787259),n=h(n,o,p,m,a[d+9],21,-343485551),m=b(m,i),n=b(n,j),o=b(o,k),p=b(p,l);return[m,n,o,p]}function j(a){var b,c=\"\";for(b=0;b<32*a.length;b+=8)c+=String.fromCharCode(a[b>>5]>>>b%32&255);return c}function k(a){var b,c=[];for(c[(a.length>>2)-1]=void 0,b=0;b<c.length;b+=1)c[b]=0;for(b=0;b<8*a.length;b+=8)c[b>>5]|=(255&a.charCodeAt(b/8))<<b%32;return c}function l(a){return j(i(k(a),8*a.length))}function m(a,b){var c,d,e=k(a),f=[],g=[];for(f[15]=g[15]=void 0,e.length>16&&(e=i(e,8*a.length)),c=0;16>c;c+=1)f[c]=909522486^e[c],g[c]=1549556828^e[c];return d=i(f.concat(k(b)),512+8*b.length),j(i(g.concat(d),640))}function n(a){var b,c,d=\"0123456789abcdef\",e=\"\";for(c=0;c<a.length;c+=1)b=a.charCodeAt(c),e+=d.charAt(b>>>4&15)+d.charAt(15&b);return e}function o(a){return unescape(encodeURIComponent(a))}function p(a){return l(o(a))}function q(a){return n(p(a))}function r(a,b){return m(o(a),o(b))}function s(a,b){return n(r(a,b))}function t(a,b,c){return b?c?r(b,a):s(b,a):c?p(a):q(a)}\"function\"==typeof define&&define.amd?define(function(){return t}):a.md5=t}(this);");
            System.out.println("write to file success : "+file.getPath());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (bufferedWriter != null) {
                    bufferedWriter.flush();
                    bufferedWriter.close();
                }
                if (fileOutputStream != null) {
                    fileOutputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void writeJsCommonJqueryJs(String htmlPath, String serverUrl) {
        File file = null;
        OutputStream fileOutputStream = null;
        BufferedWriter bufferedWriter = null;
        try {
            File folder = new File(htmlPath + "/js/common");
            folder.mkdirs();
            file = new File(htmlPath + "/js/common/jquery.js");
            //如果文件不存在，则创建文件
            file.createNewFile();
            fileOutputStream = new FileOutputStream(file);
            bufferedWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream, "utf-8"));
            bufferedWriter.write("!function(a,b){\"use strict\";\"object\"==typeof module&&\"object\"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error(\"jQuery requires a window with a document\");return b(a)}:b(a)}(\"undefined\"!=typeof window?window:this,function(a,b){\"use strict\";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement(\"script\");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q=\"3.2.1\",r=function(a,b){return new r.fn.init(a,b)},s=/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for(\"boolean\"==typeof g&&(j=g,g=arguments[h]||{},h++),\"object\"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=Array.isArray(d)))?(e?(e=!1,f=c&&Array.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:\"jQuery\"+(q+Math.random()).replace(/\\D/g,\"\"),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return\"function\"===r.type(a)},isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return(\"number\"===b||\"string\"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||\"[object Object]\"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,\"constructor\")&&b.constructor,\"function\"==typeof c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+\"\":\"object\"==typeof a||\"function\"==typeof a?j[k.call(a)]||\"object\":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,\"ms-\").replace(u,v)},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?\"\":(a+\"\").replace(s,\"\")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,\"string\"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if(\"string\"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),\"function\"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each(\"Boolean Number String Function Array Date RegExp Object Error Symbol\".split(\" \"),function(a,b){j[\"[object \"+b+\"]\"]=b.toLowerCase()});function w(a){var b=!!a&&\"length\"in a&&a.length,c=r.type(a);return\"function\"!==c&&!r.isWindow(a)&&(\"array\"===c||0===b||\"number\"==typeof b&&b>0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u=\"sizzle\"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},J=\"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped\",K=\"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",L=\"(?:\\\\\\\\.|[\\\\w-]|[^\\0-\\\\xa0])+\",M=\"\\\\[\"+K+\"*(\"+L+\")(?:\"+K+\"*([*^$|!~]?=)\"+K+\"*(?:'((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\"|(\"+L+\"))|)\"+K+\"*\\\\]\",N=\":(\"+L+\")(?:\\\\((('((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\")|((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\"+M+\")*)|.*)\\\\)|)\",O=new RegExp(K+\"+\",\"g\"),P=new RegExp(\"^\"+K+\"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\"+K+\"+$\",\"g\"),Q=new RegExp(\"^\"+K+\"*,\"+K+\"*\"),R=new RegExp(\"^\"+K+\"*([>+~]|\"+K+\")\"+K+\"*\"),S=new RegExp(\"=\"+K+\"*([^\\\\]'\\\"]*?)\"+K+\"*\\\\]\",\"g\"),T=new RegExp(N),U=new RegExp(\"^\"+L+\"$\"),V={ID:new RegExp(\"^#(\"+L+\")\"),CLASS:new RegExp(\"^\\\\.(\"+L+\")\"),TAG:new RegExp(\"^(\"+L+\"|[*])\"),ATTR:new RegExp(\"^\"+M),PSEUDO:new RegExp(\"^\"+N),CHILD:new RegExp(\"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\"+K+\"*(even|odd|(([+-]|)(\\\\d*)n|)\"+K+\"*(?:([+-]|)\"+K+\"*(\\\\d+)|))\"+K+\"*\\\\)|)\",\"i\"),bool:new RegExp(\"^(?:\"+J+\")$\",\"i\"),needsContext:new RegExp(\"^\"+K+\"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\"+K+\"*((?:-\\\\d)?\\\\d*)\"+K+\"*\\\\)|)(?=[^-]|$)\",\"i\")},W=/^(?:input|select|textarea|button)$/i,X=/^h\\d$/i,Y=/^[^{]+\\{\\s*\\[native \\w/,Z=/^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,$=/[+~]/,_=new RegExp(\"\\\\\\\\([\\\\da-f]{1,6}\"+K+\"?|(\"+K+\")|.)\",\"ig\"),aa=function(a,b,c){var d=\"0x\"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\0-\\x1f\\x7f-\\uFFFF\\w-]/g,ca=function(a,b){return b?\"\\0\"===a?\"\\ufffd\":a.slice(0,-1)+\"\\\\\"+a.charCodeAt(a.length-1).toString(16)+\" \":\"\\\\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&(\"form\"in a||\"label\"in a)},{dir:\"parentNode\",next:\"legend\"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],\"string\"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+\" \"]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if(\"object\"!==b.nodeName.toLowerCase()){(k=b.getAttribute(\"id\"))?k=k.replace(ba,ca):b.setAttribute(\"id\",k=u),o=g(a),h=o.length;while(h--)o[h]=\"#\"+k+\" \"+sa(o[h]);r=o.join(\",\"),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute(\"id\")}}}return i(a.replace(P,\"$1\"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+\" \")>d.cacheLength&&delete b[a.shift()],b[c+\" \"]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement(\"fieldset\");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split(\"|\"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return\"input\"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return(\"input\"===c||\"button\"===c)&&b.type===a}}function oa(a){return function(b){return\"form\"in b?b.parentNode&&b.disabled===!1?\"label\"in b?\"label\"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:\"label\"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&\"undefined\"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&\"HTML\"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener(\"unload\",da,!1):e.attachEvent&&e.attachEvent(\"onunload\",da)),c.attributes=ja(function(a){return a.className=\"i\",!a.getAttribute(\"className\")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment(\"\")),!a.getElementsByTagName(\"*\").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute(\"id\")===b}},d.find.ID=function(a,b){if(\"undefined\"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c=\"undefined\"!=typeof a.getAttributeNode&&a.getAttributeNode(\"id\");return c&&c.value===b}},d.find.ID=function(a,b){if(\"undefined\"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode(\"id\"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode(\"id\"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return\"undefined\"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if(\"*\"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if(\"undefined\"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML=\"<a id='\"+u+\"'></a><select id='\"+u+\"-\\r\\\\' msallowcapture=''><option selected=''></option></select>\",a.querySelectorAll(\"[msallowcapture^='']\").length&&q.push(\"[*^$]=\"+K+\"*(?:''|\\\"\\\")\"),a.querySelectorAll(\"[selected]\").length||q.push(\"\\\\[\"+K+\"*(?:value|\"+J+\")\"),a.querySelectorAll(\"[id~=\"+u+\"-]\").length||q.push(\"~=\"),a.querySelectorAll(\":checked\").length||q.push(\":checked\"),a.querySelectorAll(\"a#\"+u+\"+*\").length||q.push(\".#.+[+~]\")}),ja(function(a){a.innerHTML=\"<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>\";var b=n.createElement(\"input\");b.setAttribute(\"type\",\"hidden\"),a.appendChild(b).setAttribute(\"name\",\"D\"),a.querySelectorAll(\"[name=d]\").length&&q.push(\"name\"+K+\"*[*^$|!~]?=\"),2!==a.querySelectorAll(\":enabled\").length&&q.push(\":enabled\",\":disabled\"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(\":disabled\").length&&q.push(\":enabled\",\":disabled\"),a.querySelectorAll(\"*,:x\"),q.push(\",.*:\")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,\"*\"),s.call(a,\"[s!='']:x\"),r.push(\"!=\",N)}),q=q.length&&new RegExp(q.join(\"|\")),r=r.length&&new RegExp(r.join(\"|\")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,\"='$1']\"),c.matchesSelector&&p&&!A[b+\" \"]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+\"\").replace(ba,ca)},ga.error=function(a){throw new Error(\"Syntax error, unrecognized expression: \"+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c=\"\",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if(\"string\"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{\">\":{dir:\"parentNode\",first:!0},\" \":{dir:\"parentNode\"},\"+\":{dir:\"previousSibling\",first:!0},\"~\":{dir:\"previousSibling\"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||\"\").replace(_,aa),\"~=\"===a[2]&&(a[3]=\" \"+a[3]+\" \"),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),\"nth\"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*(\"even\"===a[3]||\"odd\"===a[3])),a[5]=+(a[7]+a[8]||\"odd\"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||\"\":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(\")\",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return\"*\"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+\" \"];return b||(b=new RegExp(\"(^|\"+K+\")\"+a+\"(\"+K+\"|$)\"))&&y(a,function(a){return b.test(\"string\"==typeof a.className&&a.className||\"undefined\"!=typeof a.getAttribute&&a.getAttribute(\"class\")||\"\")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?\"!=\"===b:!b||(e+=\"\",\"=\"===b?e===c:\"!=\"===b?e!==c:\"^=\"===b?c&&0===e.indexOf(c):\"*=\"===b?c&&e.indexOf(c)>-1:\"$=\"===b?c&&e.slice(-c.length)===c:\"~=\"===b?(\" \"+e.replace(O,\" \")+\" \").indexOf(c)>-1:\"|=\"===b&&(e===c||e.slice(0,c.length+1)===c+\"-\"))}},CHILD:function(a,b,c,d,e){var f=\"nth\"!==a.slice(0,3),g=\"last\"!==a.slice(-4),h=\"of-type\"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?\"nextSibling\":\"previousSibling\",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p=\"only\"===a&&!o&&\"nextSibling\"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error(\"unsupported pseudo: \"+a);return e[u]?e(b):e.length>1?(c=[a,a,\"\",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,\"$1\"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||\"\")||ga.error(\"unsupported lang: \"+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute(\"xml:lang\")||b.getAttribute(\"lang\"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+\"-\");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return\"input\"===b&&!!a.checked||\"option\"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return\"input\"===b&&\"button\"===a.type||\"button\"===b},text:function(a){var b;return\"input\"===a.nodeName.toLowerCase()&&\"text\"===a.type&&(null==(b=a.getAttribute(\"type\"))||\"text\"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function ra(){}ra.prototype=d.filters=d.pseudos,d.setFilters=new ra,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+\" \"];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=Q.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P,\" \")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function sa(a){for(var b=0,c=a.length,d=\"\";b<c;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&\"parentNode\"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e);return!1}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}return!1}}function ua(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d<e;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||\"*\",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[\" \"],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i<f;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e<f;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:\" \"===a[i-2].type?\"*\":\"\"})).replace(P,\"$1\"),c,i<e&&ya(a.slice(i,e)),e<f&&ya(a=a.slice(e)),e<f&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s=\"0\",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG(\"*\",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+\" \"];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m=\"function\"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&\"ID\"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split(\"\").sort(B).join(\"\")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement(\"fieldset\"))}),ja(function(a){return a.innerHTML=\"<a href='#'></a>\",\"#\"===a.firstChild.getAttribute(\"href\")})||ka(\"type|href|height|width\",function(a,b,c){if(!c)return a.getAttribute(b,\"type\"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML=\"<input/>\",a.firstChild.setAttribute(\"value\",\"\"),\"\"===a.firstChild.getAttribute(\"value\")})||ka(\"value\",function(a,b,c){if(!c&&\"input\"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute(\"disabled\")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[\":\"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext;function B(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()}var C=/^<([a-z][^\\/\\0>:\\x20\\t\\r\\n\\f]*)[\\x20\\t\\r\\n\\f]*\\/?>(?:<\\/\\1>|)$/i,D=/^.[^:#\\[\\.,]*$/;function E(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):\"string\"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):D.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=\":not(\"+a+\")\"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if(\"string\"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b<d;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;b<d;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(E(this,a||[],!1))},not:function(a){return this.pushStack(E(this,a||[],!0))},is:function(a){return!!E(this,\"string\"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var F,G=/^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]+))$/,H=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||F,\"string\"==typeof a){if(e=\"<\"===a[0]&&\">\"===a[a.length-1]&&a.length>=3?[null,a,null]:G.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),C.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};H.prototype=r.fn,F=r(d);var I=/^(?:parents|prev(?:Until|All))/,J={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a<c;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g=\"string\"!=typeof a&&r(a);if(!A.test(a))for(;d<e;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?\"string\"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function K(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,\"parentNode\")},parentsUntil:function(a,b,c){return y(a,\"parentNode\",c)},next:function(a){return K(a,\"nextSibling\")},prev:function(a){return K(a,\"previousSibling\")},nextAll:function(a){return y(a,\"nextSibling\")},prevAll:function(a){return y(a,\"previousSibling\")},nextUntil:function(a,b,c){return y(a,\"nextSibling\",c)},prevUntil:function(a,b,c){return y(a,\"previousSibling\",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return B(a,\"iframe\")?a.contentDocument:(B(a,\"template\")&&(a=a.content||a),r.merge([],a.childNodes))}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return\"Until\"!==a.slice(-5)&&(d=c),d&&\"string\"==typeof d&&(e=r.filter(d,e)),this.length>1&&(J[a]||r.uniqueSort(e),I.test(a)&&e.reverse()),this.pushStack(e)}});var L=/[^\\x20\\t\\r\\n\\f]+/g;function M(a){var b={};return r.each(a.match(L)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a=\"string\"==typeof a?M(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=e||a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:\"\")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){r.each(b,function(b,c){r.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&\"string\"!==r.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return r.each(arguments,function(a,b){var c;while((c=r.inArray(b,f,c))>-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c=\"\",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=\"\"),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function N(a){return a}function O(a){throw a}function P(a,b,c,d){var e;try{a&&r.isFunction(e=a.promise)?e.call(a).done(b).fail(c):a&&r.isFunction(e=a.then)?e.call(a,b,c):b.apply(void 0,[a].slice(d))}catch(a){c.apply(void 0,[a])}}r.extend({Deferred:function(b){var c=[[\"notify\",\"progress\",r.Callbacks(\"memory\"),r.Callbacks(\"memory\"),2],[\"resolve\",\"done\",r.Callbacks(\"once memory\"),r.Callbacks(\"once memory\"),0,\"resolved\"],[\"reject\",\"fail\",r.Callbacks(\"once memory\"),r.Callbacks(\"once memory\"),1,\"rejected\"]],d=\"pending\",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},\"catch\":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+\"With\"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b<f)){if(a=d.apply(h,i),a===c.promise())throw new TypeError(\"Thenable self-resolution\");j=a&&(\"object\"==typeof a||\"function\"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,N,e),g(f,c,O,e)):(f++,j.call(a,g(f,c,N,e),g(f,c,O,e),g(f,c,N,c.notifyWith))):(d!==N&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==O&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:N,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:N)),c[2][3].add(g(0,a,r.isFunction(d)?d:O))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+\"With\"](this===f?void 0:this,arguments),this},f[b[0]+\"With\"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(P(a,g.done(h(c)).resolve,g.reject,!b),\"pending\"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)P(e[c],h(c),g.reject);return g.promise()}});var Q=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&Q.test(b.name)&&a.console.warn(\"jQuery.Deferred exception: \"+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var R=r.Deferred();r.fn.ready=function(a){return R.then(a)[\"catch\"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||R.resolveWith(d,[r]))}}),r.ready.then=R.then;function S(){d.removeEventListener(\"DOMContentLoaded\",S),");
            bufferedWriter.write("a.removeEventListener(\"load\",S),r.ready()}\"complete\"===d.readyState||\"loading\"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener(\"DOMContentLoaded\",S),a.addEventListener(\"load\",S));var T=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if(\"object\"===r.type(c)){e=!0;for(h in c)T(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},U=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function V(){this.expando=r.expando+V.uid++}V.uid=1,V.prototype={cache:function(a){var b=a[this.expando];return b||(b={},U(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if(\"string\"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&\"string\"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){Array.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(L)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var W=new V,X=new V,Y=/^(?:\\{[\\w\\W]*\\}|\\[[\\w\\W]*\\])$/,Z=/[A-Z]/g;function $(a){return\"true\"===a||\"false\"!==a&&(\"null\"===a?null:a===+a+\"\"?+a:Y.test(a)?JSON.parse(a):a)}function _(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d=\"data-\"+b.replace(Z,\"-$&\").toLowerCase(),c=a.getAttribute(d),\"string\"==typeof c){try{c=$(c)}catch(e){}X.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return X.hasData(a)||W.hasData(a)},data:function(a,b,c){return X.access(a,b,c)},removeData:function(a,b){X.remove(a,b)},_data:function(a,b,c){return W.access(a,b,c)},_removeData:function(a,b){W.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=X.get(f),1===f.nodeType&&!W.get(f,\"hasDataAttrs\"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf(\"data-\")&&(d=r.camelCase(d.slice(5)),_(f,d,e[d])));W.set(f,\"hasDataAttrs\",!0)}return e}return\"object\"==typeof a?this.each(function(){X.set(this,a)}):T(this,function(b){var c;if(f&&void 0===b){if(c=X.get(f,a),void 0!==c)return c;if(c=_(f,a),void 0!==c)return c}else this.each(function(){X.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){X.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||\"fx\")+\"queue\",d=W.get(a,b),c&&(!d||Array.isArray(c)?d=W.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||\"fx\";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};\"inprogress\"===e&&(e=c.shift(),d--),e&&(\"fx\"===b&&c.unshift(\"inprogress\"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+\"queueHooks\";return W.get(a,c)||W.access(a,c,{empty:r.Callbacks(\"once memory\").add(function(){W.remove(a,[b+\"queue\",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return\"string\"!=typeof a&&(b=a,a=\"fx\",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),\"fx\"===a&&\"inprogress\"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||\"fx\",[])},promise:function(a,b){var c,d=1,e=r.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};\"string\"!=typeof a&&(b=a,a=void 0),a=a||\"fx\";while(g--)c=W.get(f[g],a+\"queueHooks\"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var aa=/[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/.source,ba=new RegExp(\"^(?:([+-])=|)(\"+aa+\")([a-z%]*)$\",\"i\"),ca=[\"Top\",\"Right\",\"Bottom\",\"Left\"],da=function(a,b){return a=b||a,\"none\"===a.style.display||\"\"===a.style.display&&r.contains(a.ownerDocument,a)&&\"none\"===r.css(a,\"display\")},ea=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};function fa(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,\"\")},i=h(),j=c&&c[3]||(r.cssNumber[b]?\"\":\"px\"),k=(r.cssNumber[b]||\"px\"!==j&&+i)&&ba.exec(r.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||\".5\",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var ga={};function ha(a){var b,c=a.ownerDocument,d=a.nodeName,e=ga[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,\"display\"),b.parentNode.removeChild(b),\"none\"===e&&(e=\"block\"),ga[d]=e,e)}function ia(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)d=a[f],d.style&&(c=d.style.display,b?(\"none\"===c&&(e[f]=W.get(d,\"display\")||null,e[f]||(d.style.display=\"\")),\"\"===d.style.display&&da(d)&&(e[f]=ha(d))):\"none\"!==c&&(e[f]=\"none\",W.set(d,\"display\",c)));for(f=0;f<g;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ia(this,!0)},hide:function(){return ia(this)},toggle:function(a){return\"boolean\"==typeof a?a?this.show():this.hide():this.each(function(){da(this)?r(this).show():r(this).hide()})}});var ja=/^(?:checkbox|radio)$/i,ka=/<([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]+)/i,la=/^$|\\/(?:java|ecma)script/i,ma={option:[1,\"<select multiple='multiple'>\",\"</select>\"],thead:[1,\"<table>\",\"</table>\"],col:[2,\"<table><colgroup>\",\"</colgroup></table>\"],tr:[2,\"<table><tbody>\",\"</tbody></table>\"],td:[3,\"<table><tbody><tr>\",\"</tr></tbody></table>\"],_default:[0,\"\",\"\"]};ma.optgroup=ma.option,ma.tbody=ma.tfoot=ma.colgroup=ma.caption=ma.thead,ma.th=ma.td;function na(a,b){var c;return c=\"undefined\"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||\"*\"):\"undefined\"!=typeof a.querySelectorAll?a.querySelectorAll(b||\"*\"):[],void 0===b||b&&B(a,b)?r.merge([a],c):c}function oa(a,b){for(var c=0,d=a.length;c<d;c++)W.set(a[c],\"globalEval\",!b||W.get(b[c],\"globalEval\"))}var pa=/<|&#?\\w+;/;function qa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;n<o;n++)if(f=a[n],f||0===f)if(\"object\"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(pa.test(f)){g=g||l.appendChild(b.createElement(\"div\")),h=(ka.exec(f)||[\"\",\"\"])[1].toLowerCase(),i=ma[h]||ma._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=\"\"}else m.push(b.createTextNode(f));l.textContent=\"\",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=na(l.appendChild(f),\"script\"),j&&oa(g),c){k=0;while(f=g[k++])la.test(f.type||\"\")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement(\"div\")),c=d.createElement(\"input\");c.setAttribute(\"type\",\"radio\"),c.setAttribute(\"checked\",\"checked\"),c.setAttribute(\"name\",\"t\"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML=\"<textarea>x</textarea>\",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var ra=d.documentElement,sa=/^key/,ta=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ua=/^([^.]*)(?:\\.(.+)|)/;function va(){return!0}function wa(){return!1}function xa(){try{return d.activeElement}catch(a){}}function ya(a,b,c,d,e,f){var g,h;if(\"object\"==typeof b){\"string\"!=typeof c&&(d=d||c,c=void 0);for(h in b)ya(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&(\"string\"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=wa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(ra,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return\"undefined\"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||\"\").match(L)||[\"\"],j=b.length;while(j--)h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||\"\").split(\".\").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(\".\")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.hasData(a)&&W.get(a);if(q&&(i=q.events)){b=(b||\"\").match(L)||[\"\"],j=b.length;while(j--)if(h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||\"\").split(\".\").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp(\"(^|\\\\.)\"+o.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&(\"**\"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&W.remove(a,\"handle events\")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(W.get(this,\"events\")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c<arguments.length;c++)i[c]=arguments[c];if(b.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,b)!==!1){h=r.event.handlers.call(this,b,j),c=0;while((f=h[c++])&&!b.isPropagationStopped()){b.currentTarget=f.elem,d=0;while((g=f.handlers[d++])&&!b.isImmediatePropagationStopped())b.rnamespace&&!b.rnamespace.test(g.namespace)||(b.handleObj=g,b.data=g.data,e=((r.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(b.result=e)===!1&&(b.preventDefault(),b.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,b),b.result}},handlers:function(a,b){var c,d,e,f,g,h=[],i=b.delegateCount,j=a.target;if(i&&j.nodeType&&!(\"click\"===a.type&&a.button>=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&(\"click\"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c<i;c++)d=b[c],e=d.selector+\" \",void 0===g[e]&&(g[e]=d.needsContext?r(e,this).index(j)>-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i<b.length&&h.push({elem:j,handlers:b.slice(i)}),h},addProp:function(a,b){Object.defineProperty(r.Event.prototype,a,{enumerable:!0,configurable:!0,get:r.isFunction(b)?function(){if(this.originalEvent)return b(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[a]},set:function(b){Object.defineProperty(this,a,{enumerable:!0,configurable:!0,writable:!0,value:b})}})},fix:function(a){return a[r.expando]?a:new r.Event(a)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==xa()&&this.focus)return this.focus(),!1},delegateType:\"focusin\"},blur:{trigger:function(){if(this===xa()&&this.blur)return this.blur(),!1},delegateType:\"focusout\"},click:{trigger:function(){if(\"checkbox\"===this.type&&this.click&&B(this,\"input\"))return this.click(),!1},_default:function(a){return B(a.target,\"a\")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},r.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},r.Event=function(a,b){return this instanceof r.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?va:wa,this.target=a.target&&3===a.target.nodeType?a.target.parentNode:a.target,this.currentTarget=a.currentTarget,this.relatedTarget=a.relatedTarget):this.type=a,b&&r.extend(this,b),this.timeStamp=a&&a.timeStamp||r.now(),void(this[r.expando]=!0)):new r.Event(a,b)},r.Event.prototype={constructor:r.Event,isDefaultPrevented:wa,isPropagationStopped:wa,isImmediatePropagationStopped:wa,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=va,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=va,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=va,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},r.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,info:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,\"char\":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(a){var b=a.button;return null==a.which&&sa.test(a.type)?null!=a.charCode?a.charCode:a.keyCode:!a.which&&void 0!==b&&ta.test(a.type)?1&b?1:2&b?3:4&b?2:0:a.which}},r.event.addProp),r.each({mouseenter:\"mouseover\",mouseleave:\"mouseout\",pointerenter:\"pointerover\",pointerleave:\"pointerout\"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||r.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),r.fn.extend({on:function(a,b,c,d){return ya(this,a,b,c,d)},one:function(a,b,c,d){return ya(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,r(a.delegateTarget).off(d.namespace?d.origType+\".\"+d.namespace:d.origType,d.selector,d.handler),this;if(\"object\"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&\"function\"!=typeof b||(c=b,b=void 0),c===!1&&(c=wa),this.each(function(){r.event.remove(this,a,c,b)})}});var za=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]*)[^>]*)\\/>/gi,Aa=/<script|<style|<link/i,Ba=/checked\\s*(?:[^=]|=\\s*.checked.)/i,Ca=/^true\\/(.*)/,Da=/^\\s*<!(?:\\[CDATA\\[|--)|(?:\\]\\]|--)>\\s*$/g;function Ea(a,b){return B(a,\"table\")&&B(11!==b.nodeType?b:b.firstChild,\"tr\")?r(\">tbody\",a)[0]||a:a}function Fa(a){return a.type=(null!==a.getAttribute(\"type\"))+\"/\"+a.type,a}function Ga(a){var b=Ca.exec(a.type);return b?a.type=b[1]:a.removeAttribute(\"type\"),a}function Ha(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(W.hasData(a)&&(f=W.access(a),g=W.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c<d;c++)r.event.add(b,e,j[e][c])}X.hasData(a)&&(h=X.access(a),i=r.extend({},h),X.set(b,i))}}function Ia(a,b){var c=b.nodeName.toLowerCase();\"input\"===c&&ja.test(a.type)?b.checked=a.checked:\"input\"!==c&&\"textarea\"!==c||(b.defaultValue=a.defaultValue)}function Ja(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&\"string\"==typeof q&&!o.checkClone&&Ba.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ja(f,b,c,d)});if(m&&(e=qa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(na(e,\"script\"),Fa),i=h.length;l<m;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,na(j,\"script\"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Ga),l=0;l<i;l++)j=h[l],la.test(j.type||\"\")&&!W.access(j,\"globalEval\")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Da,\"\"),k))}return a}function Ka(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(na(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&oa(na(d,\"script\")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(za,\"<$1></$2>\")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=na(h),f=na(a),d=0,e=f.length;d<e;d++)Ia(f[d],g[d]);if(b)if(c)for(f=f||na(a),g=g||na(h),d=0,e=f.length;d<e;d++)Ha(f[d],g[d]);else Ha(a,h);return g=na(h,\"script\"),g.length>0&&oa(g,!i&&na(a,\"script\")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(U(c)){if(b=c[W.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[W.expando]=void 0}c[X.expando]&&(c[X.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ka(this,a,!0)},remove:function(a){return Ka(this,a)},text:function(a){return T(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.appendChild(a)}})},prepend:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(na(a,!1)),a.textContent=\"\");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return T(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if(\"string\"==typeof a&&!Aa.test(a)&&!ma[(ka.exec(a)||[\"\",\"\"])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c<d;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(na(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ja(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(na(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:\"append\",prependTo:\"prepend\",insertBefore:\"before\",insertAfter:\"after\",replaceAll:\"replaceWith\"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;g<=f;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var La=/^margin/,Ma=new RegExp(\"^(\"+aa+\")(?!px)[a-z%]+$\",\"i\"),Na=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText=\"box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%\",i.innerHTML=\"\",ra.appendChild(h);var b=a.getComputedStyle(i);c=\"1%\"!==b.top,g=\"2px\"===b.marginLeft,e=\"4px\"===b.width,i.style.marginRight=\"50%\",f=\"4px\"===b.marginRight,ra.removeChild(h),i=null}}var c,e,f,g,h=d.createElement(\"div\"),i=d.createElement(\"div\");i.style&&(i.style.backgroundClip=\"content-box\",i.cloneNode(!0).style.backgroundClip=\"\",o.clearCloneStyle=\"content-box\"===i.style.backgroundClip,h.style.cssText=\"border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute\",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Oa(a,b,c){var d,e,f,g,h=a.style;return c=c||Na(a),c&&(g=c.getPropertyValue(b)||c[b],\"\"!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&Ma.test(g)&&La.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+\"\":g}function Pa(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Qa=/^(none|table(?!-c[ea]).+)/,Ra=/^--/,Sa={position:\"absolute\",visibility:\"hidden\",display:\"block\"},Ta={letterSpacing:\"0\",fontWeight:\"400\"},Ua=[\"Webkit\",\"Moz\",\"ms\"],Va=d.createElement(\"div\").style;function Wa(a){if(a in Va)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ua.length;while(c--)if(a=Ua[c]+b,a in Va)return a}function Xa(a){var b=r.cssProps[a];return b||(b=r.cssProps[a]=Wa(a)||a),b}function Ya(a,b,c){var d=ba.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||\"px\"):b}function Za(a,b,c,d,e){var f,g=0;for(f=c===(d?\"border\":\"content\")?4:\"width\"===b?1:0;f<4;f+=2)\"margin\"===c&&(g+=r.css(a,c+ca[f],!0,e)),d?(\"content\"===c&&(g-=r.css(a,\"padding\"+ca[f],!0,e)),\"margin\"!==c&&(g-=r.css(a,\"border\"+ca[f]+\"Width\",!0,e))):(g+=r.css(a,\"padding\"+ca[f],!0,e),\"padding\"!==c&&(g+=r.css(a,\"border\"+ca[f]+\"Width\",!0,e)));return g}function $a(a,b,c){var d,e=Na(a),f=Oa(a,b,e),g=\"border-box\"===r.css(a,\"boxSizing\",!1,e);return Ma.test(f)?f:(d=g&&(o.boxSizingReliable()||f===a.style[b]),\"auto\"===f&&(f=a[\"offset\"+b[0].toUpperCase()+b.slice(1)]),f=parseFloat(f)||0,f+Za(a,b,c||(g?\"border\":\"content\"),d,e)+\"px\")}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Oa(a,\"opacity\");return\"\"===c?\"1\":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{\"float\":\"cssFloat\"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=Ra.test(b),j=a.style;return i||(b=Xa(h)),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&\"get\"in g&&void 0!==(e=g.get(a,!1,d))?e:j[b]:(f=typeof c,\"string\"===f&&(e=ba.exec(c))&&e[1]&&(c=fa(a,b,e),f=\"number\"),null!=c&&c===c&&(\"number\"===f&&(c+=e&&e[3]||(r.cssNumber[h]?\"\":\"px\")),o.clearCloneStyle||\"\"!==c||0!==b.indexOf(\"background\")||(j[b]=\"inherit\"),g&&\"set\"in g&&void 0===(c=g.set(a,c,d))||(i?j.setProperty(b,c):j[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b),i=Ra.test(b);return i||(b=Xa(h)),g=r.cssHooks[b]||r.cssHooks[h],g&&\"get\"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Oa(a,b,d)),\"normal\"===e&&b in Ta&&(e=Ta[b]),\"\"===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each([\"height\",\"width\"],function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return!Qa.test(r.css(a,\"display\"))||a.getClientRects().length&&a.getBoundingClientRect().width?$a(a,b,d):ea(a,Sa,function(){return $a(a,b,d)})},set:function(a,c,d){var e,f=d&&Na(a),g=d&&Za(a,b,d,\"border-box\"===r.css(a,\"boxSizing\",!1,f),f);return g&&(e=ba.exec(c))&&\"px\"!==(e[3]||\"px\")&&(a.style[b]=c,c=r.css(a,b)),Ya(a,c,g)}}}),r.cssHooks.marginLeft=Pa(o.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Oa(a,\"marginLeft\"))||a.getBoundingClientRect().left-ea(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+\"px\"}),r.each({margin:\"\",padding:\"\",border:\"Width\"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f=\"string\"==typeof c?c.split(\" \"):[c];d<4;d++)e[a+ca[d]+b]=f[d]||f[d-2]||f[0];return e}},La.test(a)||(r.cssHooks[a+b].set=Ya)}),r.fn.extend({css:function(a,b){return T(this,function(a,b,c){var d,e,f={},g=0;if(Array.isArray(b)){for(d=Na(a),e=b.length;g<e;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}});function _a(a,b,c,d,e){return new _a.prototype.init(a,b,c,d,e)}r.Tween=_a,_a.prototype={constructor:_a,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?\"\":\"px\")},cur:function(){var a=_a.propHooks[this.prop];return a&&a.get?a.get(this):_a.propHooks._default.get(this)},run:function(a){var b,c=_a.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):_a.propHooks._default.set(this),this}},_a.prototype.init.prototype=_a.prototype,_a.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,\"\"),b&&\"auto\"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},_a.propHooks.scrollTop=_a.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:\"swing\"},r.fx=_a.prototype.init,r.fx.step={};var ab,bb,cb=/^(?:toggle|show|hide)$/,db=/queueHooks$/;function eb(){bb&&(d.hidden===!1&&a.requestAnimationFrame?a.requestAnimationFrame(eb):a.setTimeout(eb,r.fx.interval),r.fx.tick())}function fb(){return a.setTimeout(function(){ab=void 0}),ab=r.now()}function gb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ca[d],e[\"margin\"+c]=e[\"padding\"+c]=a;return b&&(e.opacity=e.width=a),e}function hb(a,b,c){for(var d,e=(kb.tweeners[b]||[]).concat(kb.tweeners[\"*\"]),f=0,g=e.length;f<g;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,k,l=\"width\"in b||\"height\"in b,m=this,n={},o=a.style,p=a.nodeType&&da(a),q=W.get(a,\"fxshow\");c.queue||(g=r._queueHooks(a,\"fx\"),null==g.unqueued&&(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,\"fx\").length||g.empty.fire()})}));for(d in b)if(e=b[d],cb.test(e)){if(delete b[d],f=f||\"toggle\"===e,e===(p?\"hide\":\"show\")){if(\"show\"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&&q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&&1===a.nodeType&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&&q.display,null==j&&(j=W.get(a,\"display\")),k=r.css(a,\"display\"),\"none\"===k&&(j?k=j:(ia([a],!0),j=a.style.display||j,k=r.css(a,\"display\"),ia([a]))),(\"inline\"===k||\"inline-block\"===k&&null!=j)&&\"none\"===r.css(a,\"float\")&&(i||(m.done(function(){o.display=j}),null==j&&(k=o.display,j=\"none\"===k?\"\":k)),o.display=\"inline-block\")),c.overflow&&(o.overflow=\"hidden\",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?\"hidden\"in q&&(p=q.hidden):q=W.access(a,\"fxshow\",{display:j}),f&&(q.hidden=!p),p&&ia([a],!0),m.done(function(){p||ia([a]),W.remove(a,\"fxshow\");for(d in n)r.style(a,d,n[d])})),i=hb(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&&(i.end=i.start,i.start=0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],Array.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=r.cssHooks[d],g&&\"expand\"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kb(a,b,c){var d,e,f=0,g=kb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=ab||fb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g<i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f<1&&i?c:(i||h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:ab||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;c<d;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);f<g;f++)if(d=kb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&&(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,hb,j),r.isFunction(j.opts.start)&&j.opts.start.call(a,j),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always),r.fx.timer(r.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j}r.Animation=r.extend(kb,{tweeners:{\"*\":[function(a,b){var c=this.createTween(a,b);return fa(c.elem,a,ba.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=[\"*\"]):a=a.match(L);for(var c,d=0,e=a.length;d<e;d++)c=a[d],kb.tweeners[c]=kb.tweeners[c]||[],kb.tweeners[c].unshift(b)},prefilters:[ib],prefilter:function(a,b){b?kb.prefilters.unshift(a):kb.prefilters.push(a)}}),r.speed=function(a,b,c){var d=a&&\"object\"==typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};return r.fx.off?d.duration=0:\"number\"!=typeof d.duration&&(d.duration in r.fx.speeds?d.duration=r.fx.speeds[d.duration]:d.duration=r.fx.speeds._default),null!=d.queue&&d.queue!==!0||(d.queue=\"fx\"),d.old=d.complete,d.complete=function(){r.isFunction(d.old)&&d.old.call(this),d.queue&&r.dequeue(this,d.queue)},d},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(da).css(\"opacity\",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=kb(this,r.extend({},a),f);(e||W.get(this,\"finish\"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return\"string\"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||\"fx\",[]),this.each(function(){var b=!0,e=null!=a&&a+\"queueHooks\",f=r.timers,g=W.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&db.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||r.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||\"fx\"),this.each(function(){var b,c=W.get(this),d=c[a+\"queue\"],e=c[a+\"queueHooks\"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;b<g;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),r.each([\"toggle\",\"show\",\"hide\"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||\"boolean\"==typeof a?c.apply(this,arguments):this.animate(gb(b,!0),a,d,e)}}),r.each({slideDown:gb(\"show\"),slideUp:gb(\"hide\"),slideToggle:gb(\"toggle\"),fadeIn:{opacity:\"show\"},fadeOut:{opacity:\"hide\"},fadeToggle:{opacity:\"toggle\"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(ab=r.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||r.fx.stop(),ab=void 0},r.fx.timer=function(a){r.timers.push(a),r.fx.start()},r.fx.interval=13,r.fx.start=function(){bb||(bb=!0,eb())},r.fx.stop=function(){bb=null},r.fx.speeds={slow:600,fast:200,_default:400},r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||\"fx\",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement(\"input\"),b=d.createElement(\"select\"),c=b.appendChild(d.createElement(\"option\"));a.type=\"checkbox\",o.checkOn=\"\"!==a.value,o.optSelected=c.selected,a=d.createElement(\"input\"),a.value=\"t\",a.type=\"radio\",o.radioValue=\"t\"===a.value}();var lb,mb=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return T(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return\"undefined\"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?lb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&\"set\"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+\"\"),c):e&&\"get\"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),");
            bufferedWriter.write("null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&\"radio\"===b&&B(a,\"input\")){var c=a.value;return a.setAttribute(\"type\",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(L);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),lb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\\w+/g),function(a,b){var c=mb[b]||r.find.attr;mb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=mb[g],mb[g]=e,e=null!=c(a,b,d)?g:null,mb[g]=f),e}});var nb=/^(?:input|select|textarea|button)$/i,ob=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return T(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&\"set\"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&\"get\"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,\"tabindex\");return b?parseInt(b,10):nb.test(a.nodeName)||ob.test(a.nodeName)&&a.href?0:-1}}},propFix:{\"for\":\"htmlFor\",\"class\":\"className\"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each([\"tabIndex\",\"readOnly\",\"maxLength\",\"cellSpacing\",\"cellPadding\",\"rowSpan\",\"colSpan\",\"useMap\",\"frameBorder\",\"contentEditable\"],function(){r.propFix[this.toLowerCase()]=this});function pb(a){var b=a.match(L)||[];return b.join(\" \")}function qb(a){return a.getAttribute&&a.getAttribute(\"class\")||\"\"}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,qb(this)))});if(\"string\"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&\" \"+pb(e)+\" \"){g=0;while(f=b[g++])d.indexOf(\" \"+f+\" \")<0&&(d+=f+\" \");h=pb(d),e!==h&&c.setAttribute(\"class\",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,qb(this)))});if(!arguments.length)return this.attr(\"class\",\"\");if(\"string\"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&\" \"+pb(e)+\" \"){g=0;while(f=b[g++])while(d.indexOf(\" \"+f+\" \")>-1)d=d.replace(\" \"+f+\" \",\" \");h=pb(d),e!==h&&c.setAttribute(\"class\",h)}}return this},toggleClass:function(a,b){var c=typeof a;return\"boolean\"==typeof b&&\"string\"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,qb(this),b),b)}):this.each(function(){var b,d,e,f;if(\"string\"===c){d=0,e=r(this),f=a.match(L)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&\"boolean\"!==c||(b=qb(this),b&&W.set(this,\"__className__\",b),this.setAttribute&&this.setAttribute(\"class\",b||a===!1?\"\":W.get(this,\"__className__\")||\"\"))})},hasClass:function(a){var b,c,d=0;b=\" \"+a+\" \";while(c=this[d++])if(1===c.nodeType&&(\" \"+pb(qb(c))+\" \").indexOf(b)>-1)return!0;return!1}});var rb=/\\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e=\"\":\"number\"==typeof e?e+=\"\":Array.isArray(e)&&(e=r.map(e,function(a){return null==a?\"\":a+\"\"})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&\"set\"in b&&void 0!==b.set(this,e,\"value\")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&\"get\"in b&&void 0!==(c=b.get(e,\"value\"))?c:(c=e.value,\"string\"==typeof c?c.replace(rb,\"\"):null==c?\"\":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,\"value\");return null!=b?b:pb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g=\"select-one\"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d<i;d++)if(c=e[d],(c.selected||d===f)&&!c.disabled&&(!c.parentNode.disabled||!B(c.parentNode,\"optgroup\"))){if(b=r(c).val(),g)return b;h.push(b)}return h},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each([\"radio\",\"checkbox\"],function(){r.valHooks[this]={set:function(a,b){if(Array.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute(\"value\")?\"on\":a.value})});var sb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,\"type\")?b.type:b,q=l.call(b,\"namespace\")?b.namespace.split(\".\"):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!sb.test(p+r.event.triggered)&&(p.indexOf(\".\")>-1&&(q=p.split(\".\"),p=q.shift(),q.sort()),k=p.indexOf(\":\")<0&&\"on\"+p,b=b[r.expando]?b:new r.Event(p,\"object\"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join(\".\"),b.rnamespace=b.namespace?new RegExp(\"(^|\\\\.)\"+q.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,sb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(W.get(h,\"events\")||{})[b.type]&&W.get(h,\"handle\"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&U(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!U(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each(\"blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu\".split(\" \"),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin=\"onfocusin\"in a,o.focusin||r.each({focus:\"focusin\",blur:\"focusout\"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=W.access(d,b);e||d.addEventListener(a,c,!0),W.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=W.access(d,b)-1;e?W.access(d,b,e):(d.removeEventListener(a,c,!0),W.remove(d,b))}}});var tb=a.location,ub=r.now(),vb=/\\?/;r.parseXML=function(b){var c;if(!b||\"string\"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,\"text/xml\")}catch(d){c=void 0}return c&&!c.getElementsByTagName(\"parsererror\").length||r.error(\"Invalid XML: \"+b),c};var wb=/\\[\\]$/,xb=/\\r?\\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(Array.isArray(b))r.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+\"[\"+(\"object\"==typeof e&&null!=e?b:\"\")+\"]\",e,c,d)});else if(c||\"object\"!==r.type(b))d(a,b);else for(e in b)Ab(a+\"[\"+e+\"]\",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+\"=\"+encodeURIComponent(null==c?\"\":c)};if(Array.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join(\"&\")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,\"elements\");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(\":disabled\")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!ja.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:Array.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(xb,\"\\r\\n\")}}):{name:b.name,value:c.replace(xb,\"\\r\\n\")}}).get()}});var Bb=/%20/g,Cb=/#.*$/,Db=/([?&])_=[^&]*/,Eb=/^(.*?):[ \\t]*([^\\r\\n]*)$/gm,Fb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Gb=/^(?:GET|HEAD)$/,Hb=/^\\/\\//,Ib={},Jb={},Kb=\"*/\".concat(\"*\"),Lb=d.createElement(\"a\");Lb.href=tb.href;function Mb(a){return function(b,c){\"string\"!=typeof b&&(c=b,b=\"*\");var d,e=0,f=b.toLowerCase().match(L)||[];if(r.isFunction(c))while(d=f[e++])\"+\"===d[0]?(d=d.slice(1)||\"*\",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nb(a,b,c,d){var e={},f=a===Jb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return\"string\"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e[\"*\"]&&g(\"*\")}function Ob(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Pb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while(\"*\"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader(\"Content-Type\"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+\" \"+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Qb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if(\"*\"===f)f=i;else if(\"*\"!==i&&i!==f){if(g=j[i+\" \"+f]||j[\"* \"+f],!g)for(e in j)if(h=e.split(\" \"),h[1]===f&&(g=j[i+\" \"+h[0]]||j[\"* \"+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a[\"throws\"])b=g(b);else try{b=g(b)}catch(l){return{state:\"parsererror\",error:g?l:\"No conversion from \"+i+\" to \"+f}}}return{state:\"success\",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:tb.href,type:\"GET\",isLocal:Fb.test(tb.protocol),global:!0,processData:!0,async:!0,contentType:\"application/x-www-form-urlencoded; charset=UTF-8\",accepts:{\"*\":Kb,text:\"text/plain\",html:\"text/html\",xml:\"application/xml, text/xml\",json:\"application/json, text/javascript\"},contents:{xml:/\\bxml\\b/,html:/\\bhtml/,json:/\\bjson\\b/},responseFields:{xml:\"responseXML\",text:\"responseText\",json:\"responseJSON\"},converters:{\"* text\":String,\"text html\":!0,\"text json\":JSON.parse,\"text xml\":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Ob(Ob(a,r.ajaxSettings),b):Ob(r.ajaxSettings,a)},ajaxPrefilter:Mb(Ib),ajaxTransport:Mb(Jb),ajax:function(b,c){\"object\"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks(\"once memory\"),u=o.statusCode||{},v={},w={},x=\"canceled\",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Eb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||tb.href)+\"\").replace(Hb,tb.protocol+\"//\"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||\"*\").toLowerCase().match(L)||[\"\"],null==o.crossDomain){j=d.createElement(\"a\");try{j.href=o.url,j.href=j.href,o.crossDomain=Lb.protocol+\"//\"+Lb.host!=j.protocol+\"//\"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&\"string\"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Nb(Ib,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger(\"ajaxStart\"),o.type=o.type.toUpperCase(),o.hasContent=!Gb.test(o.type),f=o.url.replace(Cb,\"\"),o.hasContent?o.data&&o.processData&&0===(o.contentType||\"\").indexOf(\"application/x-www-form-urlencoded\")&&(o.data=o.data.replace(Bb,\"+\")):(n=o.url.slice(f.length),o.data&&(f+=(vb.test(f)?\"&\":\"?\")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Db,\"$1\"),n=(vb.test(f)?\"&\":\"?\")+\"_=\"+ub++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader(\"If-Modified-Since\",r.lastModified[f]),r.etag[f]&&y.setRequestHeader(\"If-None-Match\",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader(\"Content-Type\",o.contentType),y.setRequestHeader(\"Accept\",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+(\"*\"!==o.dataTypes[0]?\", \"+Kb+\"; q=0.01\":\"\"):o.accepts[\"*\"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x=\"abort\",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Nb(Jb,o,c,y)){if(y.readyState=1,l&&q.trigger(\"ajaxSend\",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort(\"timeout\")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,\"No Transport\");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||\"\",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Pb(o,y,d)),v=Qb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader(\"Last-Modified\"),w&&(r.lastModified[f]=w),w=y.getResponseHeader(\"etag\"),w&&(r.etag[f]=w)),204===b||\"HEAD\"===o.type?x=\"nocontent\":304===b?x=\"notmodified\":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x=\"error\",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+\"\",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?\"ajaxSuccess\":\"ajaxError\",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger(\"ajaxComplete\",[y,o]),--r.active||r.event.trigger(\"ajaxStop\")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,\"json\")},getScript:function(a,b){return r.get(a,void 0,b,\"script\")}}),r.each([\"get\",\"post\"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:\"GET\",dataType:\"script\",cache:!0,async:!1,global:!1,\"throws\":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not(\"body\").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Rb={0:200,1223:204},Sb=r.ajaxSettings.xhr();o.cors=!!Sb&&\"withCredentials\"in Sb,o.ajax=Sb=!!Sb,r.ajaxTransport(function(b){var c,d;if(o.cors||Sb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e[\"X-Requested-With\"]||(e[\"X-Requested-With\"]=\"XMLHttpRequest\");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,\"abort\"===a?h.abort():\"error\"===a?\"number\"!=typeof h.status?f(0,\"error\"):f(h.status,h.statusText):f(Rb[h.status]||h.status,h.statusText,\"text\"!==(h.responseType||\"text\")||\"string\"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c(\"error\"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c(\"abort\");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:\"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"},contents:{script:/\\b(?:java|ecma)script\\b/},converters:{\"text script\":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter(\"script\",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type=\"GET\")}),r.ajaxTransport(\"script\",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r(\"<script>\").prop({charset:a.scriptCharset,src:a.url}).on(\"load error\",c=function(a){b.remove(),c=null,a&&f(\"error\"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Tb=[],Ub=/(=)\\?(?=&|$)|\\?\\?/;r.ajaxSetup({jsonp:\"callback\",jsonpCallback:function(){var a=Tb.pop()||r.expando+\"_\"+ub++;return this[a]=!0,a}}),r.ajaxPrefilter(\"json jsonp\",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Ub.test(b.url)?\"url\":\"string\"==typeof b.data&&0===(b.contentType||\"\").indexOf(\"application/x-www-form-urlencoded\")&&Ub.test(b.data)&&\"data\");if(h||\"jsonp\"===b.dataTypes[0])return e=b.jsonpCallback=r.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Ub,\"$1\"+e):b.jsonp!==!1&&(b.url+=(vb.test(b.url)?\"&\":\"?\")+b.jsonp+\"=\"+e),b.converters[\"script json\"]=function(){return g||r.error(e+\" was not called\"),g[0]},b.dataTypes[0]=\"json\",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?r(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Tb.push(e)),g&&r.isFunction(f)&&f(g[0]),g=f=void 0}),\"script\"}),o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument(\"\").body;return a.innerHTML=\"<form></form><form></form>\",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if(\"string\"!=typeof a)return[];\"boolean\"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(\"\"),e=b.createElement(\"base\"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=C.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=qa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))},r.fn.load=function(a,b,c){var d,e,f,g=this,h=a.indexOf(\" \");return h>-1&&(d=pb(a.slice(h)),a=a.slice(0,h)),r.isFunction(b)?(c=b,b=void 0):b&&\"object\"==typeof b&&(e=\"POST\"),g.length>0&&r.ajax({url:a,type:e||\"GET\",dataType:\"html\",data:b}).done(function(a){f=arguments,g.html(d?r(\"<div>\").append(r.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},r.each([\"ajaxStart\",\"ajaxStop\",\"ajaxComplete\",\"ajaxError\",\"ajaxSuccess\",\"ajaxSend\"],function(a,b){r.fn[b]=function(a){return this.on(b,a)}}),r.expr.pseudos.animated=function(a){return r.grep(r.timers,function(b){return a===b.elem}).length},r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,\"position\"),l=r(a),m={};\"static\"===k&&(a.style.position=\"relative\"),h=l.offset(),f=r.css(a,\"top\"),i=r.css(a,\"left\"),j=(\"absolute\"===k||\"fixed\"===k)&&(f+i).indexOf(\"auto\")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&&(b=b.call(a,c,r.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),\"using\"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),b=f.ownerDocument,c=b.documentElement,e=b.defaultView,{top:d.top+e.pageYOffset-c.clientTop,left:d.left+e.pageXOffset-c.clientLeft}):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return\"fixed\"===r.css(c,\"position\")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),B(a[0],\"html\")||(d=a.offset()),d={top:d.top+r.css(a[0],\"borderTopWidth\",!0),left:d.left+r.css(a[0],\"borderLeftWidth\",!0)}),{top:b.top-d.top-r.css(c,\"marginTop\",!0),left:b.left-d.left-r.css(c,\"marginLeft\",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&\"static\"===r.css(a,\"position\"))a=a.offsetParent;return a||ra})}}),r.each({scrollLeft:\"pageXOffset\",scrollTop:\"pageYOffset\"},function(a,b){var c=\"pageYOffset\"===b;r.fn[a]=function(d){return T(this,function(a,d,e){var f;return r.isWindow(a)?f=a:9===a.nodeType&&(f=a.defaultView),void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each([\"top\",\"left\"],function(a,b){r.cssHooks[b]=Pa(o.pixelPosition,function(a,c){if(c)return c=Oa(a,b),Ma.test(c)?r(a).position()[b]+\"px\":c})}),r.each({Height:\"height\",Width:\"width\"},function(a,b){r.each({padding:\"inner\"+a,content:b,\"\":\"outer\"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||\"boolean\"!=typeof e),h=c||(e===!0||f===!0?\"margin\":\"border\");return T(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf(\"outer\")?b[\"inner\"+a]:b.document.documentElement[\"client\"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body[\"scroll\"+a],f[\"scroll\"+a],b.body[\"offset\"+a],f[\"offset\"+a],f[\"client\"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),r.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,\"**\"):this.off(b,a||\"**\",c)}}),r.holdReady=function(a){a?r.readyWait++:r.ready(!0)},r.isArray=Array.isArray,r.parseJSON=JSON.parse,r.nodeName=B,\"function\"==typeof define&&define.amd&&define(\"jquery\",[],function(){return r});var Vb=a.jQuery,Wb=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=Wb),b&&a.jQuery===r&&(a.jQuery=Vb),r},b||(a.jQuery=a.$=r),r});");
            System.out.println("write to file success : "+file.getPath());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (bufferedWriter != null) {
                    bufferedWriter.flush();
                    bufferedWriter.close();
                }
                if (fileOutputStream != null) {
                    fileOutputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void writeScriptForTablePage(String serverUrl, String fileServer, BufferedWriter bufferedWriter) throws IOException {
        bufferedWriter.write("<script>\n" +
                "$(function () {\n" +
                "    queryPage(1);\n" +
                "    getButtons();\n" +
                "});\n" +
                "$.getScript(\"../js/common/custom.js\");\n" +
                "var removeAllBox = function () {\n" +
                "    $(\".showSelectBox\").remove();\n" +
                "    $(\".showBindSelectBox\").remove();\n" +
                "    $(\".showBindFixedStringSelectBox\").remove();\n" +
                "    $(\".showBindDataSourceSelectBox\").remove();\n" +
                "    $(\".showConfigBox\").remove();\n" +
                "}\n" +
                "\n" +
                "var getButtons = function(){\n" +
                "}\n" +
                "\n" +
                "var showConfig = function(table){\n" +
                "    removeAllBox();\n" +
                "    var offset = $(\".class_button_show_config\").offset();\n" +
                "    var left = offset.left;\n" +
                "    var top = offset.top;\n" +
                "    var divString = \"<div class='showConfigBox' style='border:1px solid #666666; padding:6px; margin:6px;\"\n" +
                "        +\" background-color: #FFFFFF; color: #666666; position: fixed; width:366px; height:266px;z-index:9;top:\"\n" +
                "        + top + \"px;left:\"+ (left>366?(left-366):left) +\"px;'>\";\n" +
                "    divString += \"<button onclick=\\\"$('.showSelectBox').remove();\\\">关闭</button>\";\n" +
                "    var token=localStorage.getItem(\"token\");\n" +
                "    $.ajax({\n" +
                "        url: \"" + serverUrl + "/v1/common/selectConfig/mock/config_table_\"+table,\n" +
                "        type: \"get\",\n" +
                "        cache: false,\n" +
                "        headers: {\"token\": token },\n" +
                "        async: true,\n" +
                "        contentType: \"application/json\",\n" +
                "        success: function (res) {\n" +
                "            if (res.status == 200) {\n" +
                "                var configValue=eval('('+res.data.configValue+')');\n" +
                "            }\n" +
                "        },\n" +
                "        error: function (message) {\n" +
                "            //alert(message.responseText == undefined ? \"CANNOT_CONNECT_TO_SERVER\" : message.responseText);\n" +
                "        }\n" +
                "    });" +
                "}\n" +
                "\n" +
                "var showSelectBox = function(orderId,field){\n" +
                "    removeAllBox();\n" +
                "}\n" +
                "\n" +
                "var showNewSelectBox = function (table, field) {\n" +
                "    removeAllBox();\n" +
                "    var offset = $(\".class_image_show_add_line_\" + field).offset();\n" +
                "    var left = offset.left;\n" +
                "    var top = offset.top;\n" +
                "    var divString = \"<div class='showSelectBox' style='border:1px solid #666666; padding:6px; margin:6px;\"\n" +
                "        +\" background-color: #FFFFFF; color: #666666; position: fixed; width:366px; height:266px;z-index:9;top:\"\n" +
                "        + top + \"px;left:\"+ (left>366?(left-366):left) +\"px;'>\";\n" +
                "    divString += \"<button onclick=\\\"$('.showSelectBox').remove();\\\">关闭</button>\";\n" +
                "    divString += \"<button onclick=\\\"bindSelectBox('\" + table + \"','\" + field + \"')\\\">重新绑定</button>\";\n" +
                "    var token=localStorage.getItem(\"token\");\n" +
                "    $.ajax({\n" +
                "        url: \"" + serverUrl + "/v1/common/selectConfig/mock/bind_table_\"+table+\"_field_\"+field,\n" +
                "        type: \"get\",\n" +
                "        cache: false,\n" +
                "        headers: {\"token\": token },\n" +
                "        async: true,\n" +
                "        contentType: \"application/json\",\n" +
                "        success: function (res) {\n" +
                "            if (res.status == 200) {\n" +
                "                var configValue=eval('('+res.data.configValue+')');\n" +
                "                if(configValue.bind=='file'){\n" +
                "                    divString+=\"<div><form class='uploadFileForm'><input type='file' name='file' class='fileUpload'>\"+\n" +
                "                        \"</form></div><div><button onclick=\\\"uploadFile('\"+field+\"')\\\">上传</button></div>\";\n" +
                "                }\n" +
                "                if(configValue.bind=='list'){\n" +
                "                    divString += \"<div>\";\n" +
                "                    divString += \"<div>\";\n" +
                "                    divString += configValue.description;\n" +
                "                    divString += \"</div>\";\n" +
                "                    for(i=0;i<configValue.data.length;i++){\n" +
                "                        divString+=\"<button style='margin:6px;padding:6px;' onclick=\\\"$('.class_input_add_line_\"+field+\"').val(\"+configValue.data[i]+\");removeAllBox();\\\">\"+configValue.data[i]+\"</button>\";\n" +
                "                    }\n" +
                "                    divString += \"</div>\";\n" +
                "                }\n" +
                "                if(configValue.bind=='datasource'){\n" +
                "                    divString += \"<div>\";\n" +
                "                    divString += \"<div>\";\n" +
                "                    divString += configValue.description;\n" +
                "                    divString += \"</div>\";\n" +
                "                    var token=localStorage.getItem(\"token\");\n" +
                "                    var queryUrl=\"" + serverUrl + "/v1/common/\"+configValue.data.table+\"/distinct?field=\"+configValue.data.field;\n" +
                "                    $.ajax({\n" +
                "                      url: queryUrl,\n" +
                "                      type: \"get\",\n" +
                "                      cache: false,\n" +
                "                      headers: {\"token\": token },\n" +
                "                      async: true,\n" +
                "                      contentType: \"application/json\",\n" +
                "                      success: function (res) {\n" +
                "                          if (res.status == 200) {\n" +
                "                              divString += \"<select class='class_select_datasource' style='font-size:12px;'>\";\n" +
                "                              divString += \"<option value='' >------请选择------</option>\";\n" +
                "                              for(i = 0;i<res.data.length;i++){\n" +
                "                                  divString += \"<option value='\"+res.data[i]+\"' \"+($('.class_input_add_line_'+field).val()==res.data[i]?'selected':'') +\" >\"+res.data[i]+\"</option>\";\n" +
                "                              }\n" +
                "                              divString += \"</select>\";\n" +
                "                              divString += \"<button onclick=\\\"$('.class_input_add_line_\"+field+\"').val($('.class_select_datasource').val());removeAllBox();\\\">确定</button>\";\n" +
                "                              divString += \"</div>\";\n" +
                "                              divString += \"</div>\";\n" +
                "                              if($(\".thisFieldHasData_table_\"+table+\"_field_\"+field+\"\").html()==undefined){\n" +
                "                                   divString += \"<span class='thisFieldHasData_table_\"+table+\"_field_\"+field+\"' style='display:none'>\"+res.data.configValue+\"</span>\";\n" +
                "                              }else{\n" +
                "                               $(\".thisFieldHasData_table_\"+table+\"_field_\"+field+\"\").html(res.data.configValue);\n" +
                "                              }\n" +
                "                              $(\"body\").append(divString);\n" +
                "                          } else {\n" +
                "                              divString += \"</div>\";\n" +
                "                              divString += \"</div>\";\n" +
                "                              if($(\".thisFieldHasData_table_\"+table+\"_field_\"+field+\"\").html()==undefined){\n" +
                "                                   divString += \"<span class='thisFieldHasData_table_\"+table+\"_field_\"+field+\"' style='display:none'>\"+res.data.configValue+\"</span>\";\n" +
                "                              }else{\n" +
                "                                   $(\".thisFieldHasData_table_\"+table+\"_field_\"+field+\"\").html(res.data.configValue);\n" +
                "                              }\n" +
                "                              $(\"body\").append(divString);\n" +
                "                          }\n" +
                "                      },\n" +
                "                      error: function (message) {\n" +
                "                          //alert(message.responseText == undefined ? \"CANNOT_CONNECT_TO_SERVER\" : message.responseText);\n" +
                "                      }\n" +
                "                    });" +
                "                }else{\n" +
                "                    divString += \"</div>\";\n" +
                "                    if($(\".thisFieldHasData_table_\"+table+\"_field_\"+field+\"\").html()==undefined){\n" +
                "                       divString += \"<span class='thisFieldHasData_table_\"+table+\"_field_\"+field+\"' style='display:none'>\"+res.data.configValue+\"</span>\";\n" +
                "                    }else{\n" +
                "                       $(\".thisFieldHasData_table_\"+table+\"_field_\"+field+\"\").html(res.data.configValue);\n" +
                "                    }\n" +
                "                    $(\"body\").append(divString);\n" +
                "                }\n" +
                "            } else {\n" +
                "                divString += \"</div>\";\n" +
                "                $(\"body\").append(divString);\n" +
                "            }\n" +
                "        },\n" +
                "        error: function (message) {\n" +
                "            //alert(message.responseText == undefined ? \"CANNOT_CONNECT_TO_SERVER\" : message.responseText);\n" +
                "        }\n" +
                "    });" +
                "}\n" +
                "\n" +
                "var uploadFile = function(field){\n" +
                "    var formData = new FormData($('.uploadFileForm')[0]);\n" +
                "    $.ajax({\n" +
                "        type: 'post',\n" +
                "        url: \"" + fileServer + "\",\n" +
                "        data: formData,\n" +
                "        cache: false,\n" +
                "        processData: false,\n" +
                "        contentType: false,\n" +
                "        success:function (res) {\n" +
                "            if(res.status==200){\n" +
                "                $('.class_input_add_line_'+field).val(res.data);\n" +
                "                $('.showSelectBox').remove();\n" +
                "            }\n" +
                "        },\n" +
                "        error:function (message) {\n" +
                "            alert(\"上传失败:message:\"+message);\n" +
                "        },\n" +
                "    });\n" +
                "}\n" +
                "\n" +
                "var bindSelectBox = function(table,field){\n" +
                "    removeAllBox();\n" +
                "    var offset = $(\".class_image_show_add_line_\" + field).offset();\n" +
                "    var left = offset.left;\n" +
                "    var top = offset.top;\n" +
                "    var divString = \"<div class='showBindSelectBox' style='border:1px solid #666666; padding:6px; margin:6px; background-color: #FFFFFF; color: #666666; position: fixed; width:366px; height:266px;z-index:10;top:\" + top + \"px;left:\"+ (left>366?(left-366):left) +\"px;'>\";\n" +
                "    divString += \"<div><button onclick=\\\"$('.showBindSelectBox').remove();\\\">关闭</button></div>\";\n" +
                "    divString += \"<div>\"\n" +
                "    divString += \"<div><button onclick=\\\"bindUploadSelectBox('\" + table + \"','\" + field + \"')\\\">绑定上传图片</button></div>\";\n" +
                "    divString += \"<div><button onclick=\\\"bindFixedStringSelectBox('\" + table + \"','\" + field + \"')\\\">绑定固定字符下拉框</button></div>\";\n" +
                "    divString += \"<div><button onclick=\\\"bindDataSourceSelectBox('\" + table + \"','\" + field + \"')\\\">绑定数据源下拉框</button></div>\";\n" +
                "    divString += \"</div>\"\n" +
                "    divString += \"</div>\";\n" +
                "    $(\"body\").append(divString);\n" +
                "}\n" +
                "\n" +
                "var bindDataSourceSelectBox = function(table,field){\n" +
                "    removeAllBox();\n" +
                "    var offset = $(\".class_image_show_add_line_\" + field).offset();\n" +
                "    var left = offset.left;\n" +
                "    var top = offset.top;\n" +
                "    var divString = \"<div class='showBindDataSourceSelectBox' style='border:1px solid #666666; padding:6px; margin:6px;\"+\n" +
                "        \"background-color: #FFFFFF; color: #666666; position: fixed; width:366px; height:266px;z-index:11;top:\" + top +\n" +
                "        \"px;left:\" + (left>366?(left-366):left) + \"px;'>\";\n" +
                "    divString += \"<button onclick=\\\"$('.showBindDataSourceSelectBox').remove();\\\">关闭</button>\";\n" +
                "    divString += \"<div><textarea class='configValueTextarea' style='width:356px;height:166px;font-size:12px;'>\";\n" +
                "    var configValueString=$('.thisFieldHasData_table_'+table+'_field_'+field).html();\n" +
                "    var configValue=eval('('+configValueString+')');\n" +
                "    if(configValue.bind==\"datasource\"){\n" +
                "      divString += \"\"+$('.thisFieldHasData_table_'+table+'_field_'+field).html()+\"\";\n" +
                "    }else{\n" +
                "      divString += \"{\\\"bind\\\":\\\"datasource\\\",\\\"description\\\":\\\"\\\",\\\"data\\\":{\\\"table\\\":\\\"\\\",\\\"field\\\":\\\"\\\"}}\";\n" +
                "    }\n" +
                "    divString += \"</textarea></div>\";\n" +
                "    divString += \"<button onclick=\\\"bindFixedStringSelectBoxButtonClick('\" + table + \"','\" + field + \"')\\\">确定</button>\";\n" +
                "    divString += \"</div>\";\n" +
                "    $(\"body\").append(divString);\n" +
                "}\n" +
                "\n" +
                "var bindFixedStringSelectBox = function(table,field){\n" +
                "    removeAllBox();\n" +
                "    var offset = $(\".class_image_show_add_line_\" + field).offset();\n" +
                "    var left = offset.left;\n" +
                "    var top = offset.top;\n" +
                "    var divString = \"<div class='showBindFixedStringSelectBox' style='border:1px solid #666666; padding:6px; margin:6px;\"+\n" +
                "        \"background-color: #FFFFFF; color: #666666; position: fixed; width:366px; height:266px;z-index:11;top:\" + top +\n" +
                "        \"px;left:\" + (left>366?(left-366):left) + \"px;'>\";\n" +
                "    divString += \"<div><button onclick=\\\"$('.showBindFixedStringSelectBox').remove();\\\">关闭</button>" +
                "    <button onclick=\\\"bindFixedStringSelectBoxButtonClick('\" + table + \"','\" + field + \"')\\\">确定</button></div>\";\n" +
                "    divString += \"<div><textarea class='configValueTextarea' style='width:356px;height:166px;font-size:12px;'>\";\n" +
                "    var configValueString=$('.thisFieldHasData_table_'+table+'_field_'+field).html();\n" +
                "    if(configValueString==undefined){\n" +
                "       divString += \"{\\\"bind\\\":\\\"list\\\",\\\"description\\\":\\\"\\\",\\\"data\\\":[\\\"\\\"]}\";\n" +
                "    }else{\n" +
                "       var configValue=eval('('+configValueString+')');\n" +
                "       if(configValue.bind==\"list\"){\n" +
                "           divString += \"\"+$('.thisFieldHasData_table_'+table+'_field_'+field).html()+\"\";\n" +
                "       }else{\n" +
                "           divString += \"{\\\"bind\\\":\\\"list\\\",\\\"description\\\":\\\"\\\",\\\"data\\\":[\\\"\\\"]}\";\n" +
                "       }\n" +
                "    }\n" +
                "    divString += \"</textarea></div>\";\n" +
                "    divString += \"<div></div>\";\n" +
                "    divString += \"</div>\";\n" +
                "    $(\"body\").append(divString);\n" +
                "}\n" +
                "\n" +
                "var bindFixedStringSelectBoxButtonClick = function(table,field){\n" +
                "  var token=localStorage.getItem(\"token\");\n" +
                "  var queryUrl=\"" + serverUrl + "/v1/common/selectConfig/\"+($('.thisFieldHasData_table_'+table+'_field_'+field).html()==undefined?\"add\":\"update\");\n" +
                "  $.ajax({\n" +
                "    url: queryUrl,\n" +
                "    type: \"post\",\n" +
                "    cache: false,\n" +
                "    headers: {\"token\": token },\n" +
                "    async: true,\n" +
                "    contentType: \"application/json\",\n" +
                "    data: JSON.stringify({\n" +
                "        \"configKey\": \"bind_table_\"+table+\"_field_\"+field+\"\",\n" +
                "        \"configValue\": $(\".configValueTextarea\").val(),\n" +
                "    }),\n" +
                "    success: function (res) {\n" +
                "        if (res.status == 200) {\n" +
                "            $('.showBindFixedStringSelectBox').remove();\n" +
                "            showNewSelectBox(table,field);\n" +
                "        } else {\n" +
                "            $('.showBindFixedStringSelectBox').remove();\n" +
                "            showNewSelectBox(table,field);\n" +
                "        }\n" +
                "    },\n" +
                "    error: function (message) {\n" +
                "        //alert(message.responseText == undefined ? \"CANNOT_CONNECT_TO_SERVER\" : message.responseText);\n" +
                "    }\n" +
                "  });" +
                "}\n" +
                "\n" +
                "var bindUploadSelectBox = function(table,field){\n" +
                "  var token=localStorage.getItem(\"token\");\n" +
                "  var queryUrl=\"" + serverUrl + "/v1/common/selectConfig/\"+($('.thisFieldHasData_table_'+table+'_field_'+field).html()==undefined?\"add\":\"update\");\n" +
                "  $.ajax({\n" +
                "    url: queryUrl,\n" +
                "    type: \"post\",\n" +
                "    cache: false,\n" +
                "    headers: {\"token\": token },\n" +
                "    async: true,\n" +
                "    contentType: \"application/json\",\n" +
                "    data: JSON.stringify({\n" +
                "        \"configKey\": \"bind_table_\"+table+\"_field_\"+field+\"\",\n" +
                "        \"configValue\": \"{\\\"bind\\\":\\\"file\\\",\\\"description\\\":\\\"上传文件绑定专用\\\"}\",\n" +
                "    }),\n" +
                "    success: function (res) {\n" +
                "        if (res.status == 200) {\n" +
                "            removeAllBox();\n" +
                "        } else {\n" +
                "            removeAllBox();\n" +
                "        }\n" +
                "    },\n" +
                "    error: function (message) {\n" +
                "        //alert(message.responseText == undefined ? \"CANNOT_CONNECT_TO_SERVER\" : message.responseText);\n" +
                "    }\n" +
                "  });" +
                "}\n" +
                "</script>\n");
    }

    public static void writeTablePage(IntrospectedTable introspectedTable, String htmlPath, String modelUrl, String fileServer, String serverUrl, String basePackage, String aspectPackage) {
        String table = introspectedTable.getBaseRecordType();
        String tableName = table.replaceAll(modelUrl + ".", "");
        File file = null;
        OutputStream outputStream = null;
        BufferedWriter bufferedWriter = null;
        try {
            File folder = new File(htmlPath + "/content");
            folder.mkdirs();
            String fileString = htmlPath + "/content/" + tableName + ".html";
            /** 如果文件存在则删除 */
            file = new File(fileString);
            //file.deleteOnExit();
            /** 创建文件 */
            file = new File(fileString);
            file.createNewFile();
            outputStream = new FileOutputStream(file);
            bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream, "utf-8"));
            bufferedWriter.write("<!DOCTYPE html>\n");
            bufferedWriter.write("<html lang=\"zh-CN\">\n");
            bufferedWriter.write("<head>\n");
            bufferedWriter.write("<meta charset=\"UTF-8\">\n");
            bufferedWriter.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n");
            bufferedWriter.write("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\">\n");
            bufferedWriter.write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no\">\n");
            bufferedWriter.write("<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\">\n");
            bufferedWriter.write("<meta name=\"referrer\" content=\"always\">\n");
            bufferedWriter.write("<meta http-equiv=\"Cache-Control\" content=\"max-age=31536000\" />\n");
            bufferedWriter.write("<title>" + tableName + "</title>\n");
            bufferedWriter.write("<script src=\"../js/common/jquery.js\" type=\"text/javascript\"></script>\n");
            bufferedWriter.write("<script src=\"../js/common/server.js\" type=\"text/javascript\"></script>\n");
            bufferedWriter.write("<script src=\"../js/plus/trumbowyg.js\" type=\"text/javascript\"></script>\n");
            bufferedWriter.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"../js/plus/trumbowyg.css\">\n");
            writeScriptForTablePage(serverUrl,fileServer,bufferedWriter);
            bufferedWriter.write("<style>\n");
            bufferedWriter.write(".class_span_page{cursor:pointer;}\n");
            bufferedWriter.write(".class_span_page:hover{background-color:#ffff00;cursor:pointer;}\n");
            bufferedWriter.write(".class_article_section_pager_top{margin-top: 8px;margin-bottom: 8px;}\n");
            bufferedWriter.write(".class_article_section_pager_bottom{margin-top: 8px;margin-bottom: 8px;}\n");
            bufferedWriter.write(".class_div_query_button_and_number{margin-top: 6px;height:31px;padding-bottom:6px;}\n");
            bufferedWriter.write("table{ empty-cells:show; border-collapse: collapse; margin:0 auto; } td{ height:30px; } h1,h2,h3{ font-size:12px; margin:0; padding:0; } .table{ width:100%; border:1px solid #cad9ea; color:#666; } .table th { background-repeat:repeat-x; height:30px; } .table td,.table th{ border:1px solid #cad9ea; padding:0 1em 0; } .table tr.alter{ background-color:#f5fafe; }\n");
            bufferedWriter.write(".btn { padding: 5px; color: #fff; text-decoration: none; cursor: pointer; }  .btn * { font-style: normal; background-repeat: no-repeat; display: block; position: relative; }  .btn i { background-position: top left; position: absolute; margin-bottom: -5px;  top: 0; left: 0; width: 5px; height: 5px; }  .btn span { background-position: bottom left; left: -5px; padding: 0 0 5px 10px; margin-bottom: -5px; }  .btn span i { background-position: bottom right; margin-bottom: 0; position: absolute; left: 100%; width: 10px; height: 100%; top: 0; }  .btn span span { background-position: top right; position: absolute; right: -10px; margin-left: 10px; top: -5px; height: 0; }  * html .btn span,  * html .btn i { float: left; width: auto; background-image: none; cursor: pointer; }  .btn.pink { background: #e1a; }  .btn:hover { background-color: #a00; }  .btn:active { background-color: #444; }  .btn[class] {  background-position: bottom; }  * html .btn { border: 3px double #aaa; }   * html .btn.pink { border-color: #e1a; }  * html .btn:hover { border-color: #a00; }  p { clear: both; padding-bottom: 2em; }  form { margin-top: 2em; }  form p .btn { margin-right: 1em; }  textarea { margin: 1em 0;}\n");
            bufferedWriter.write("</style>\n");
            MybatisUtilHtmlBack.writeScriptQueryFunction(bufferedWriter, introspectedTable, tableName);
            bufferedWriter.write("</head>\n");
            bufferedWriter.write("<body style='font-size:12px;'>\n");
            bufferedWriter.write("<header>\n");
            bufferedWriter.write("<div class='class_div_query_util'>\n");
            MybatisUtilHtmlBack.writeQueryDiv(bufferedWriter, introspectedTable, tableName);
            bufferedWriter.write("</div>\n");
            bufferedWriter.write("<div class='class_div_query_button_and_number'>" +
                    "<button title='增加一条记录' style='padding:6px;font-size:12px;'  class='btn class_button_query' onclick='addLine()' ><image src='" + newImageSrc + "' /></button>" +
                    "<button title='展示按钮配置' class='btn class_button_query class_button_show_config' style='padding:6px;cursor:pointer' onclick=\"showConfig('" + tableName + "')\" ><image src='" + configImageSrc + "' /></button>" +
                    "<span class='class_custom_buttons'>&nbsp;</span>" +
                    "</div>\n" +
                    "");
            bufferedWriter.write("<div class='class_div_add_line' style='display:none'>");
            bufferedWriter.write("<div style='height:31px;padding-bottom:6px;' class='class_div_add_line_button'>" +
                    "<button title='确认增加记录' class='btn class_button_query' onclick='submitThisLineDiv()' ><image src='" + yesImageSrc + "' /></button>" +
                    "<button title='取消增加记录' class='btn class_button_query' onclick='closeThisLineDiv()' ><image src='" + noImageSrc + "' /></button>" +
                    "</div>");
            List<IntrospectedColumn> introspectedColumns = introspectedTable.getAllColumns();
            //List<IntrospectedColumn> introspectedColumnsPrimaryKey = introspectedTable.getPrimaryKeyColumns();
            Iterator<IntrospectedColumn> iterator = introspectedColumns.iterator();
            while (iterator.hasNext()) {
                IntrospectedColumn introspectedColumn = iterator.next();
                String columnName = introspectedColumn.getJavaProperty();
                //System.out.println(tableName+":"+columnName+":"+introspectedColumn.getLength());
                if(introspectedColumn.getLength()> MybatisUtilCommon.COLUMN_FIELD_LENGTH || introspectedColumn.isBLOBColumn()) {
                    bufferedWriter.write("<div class='class_div_add_line_column' style='padding-bottom:6px;'>" + columnName +
                            " : <div type=text style='height:366px' class='class_input_add_line_column class_input_add_line_" + columnName +
                            "' ></div><script>$(function () {\n" +
                            "            $.trumbowyg.svgPath = '../js/plus/icons.svg';\n" +
                            "            $('.class_input_add_line_"+columnName+"').trumbowyg();\n" +
                            "        });</script></div>\n");
                }else{
                    bufferedWriter.write("<div class='class_div_add_line_column' style='padding-bottom:6px;'>" + columnName +
                            " : <input type=text style='width:366px;' class='class_input_add_line_column class_input_add_line_" + columnName +
                            "' /><image style='cursor:pointer; ' class='class_image_show_add_line_" + columnName + "' src='" + editImageSrc +
                            "' onclick=\"showNewSelectBox('" + MybatisUtilCommon.toLowerCaseAtFirstCharacter(tableName) + "','" + columnName + "')\" /></div>\n");
                }
            }
            bufferedWriter.write("</div>\n");
            bufferedWriter.write("</header>\n");
            bufferedWriter.write("<article>\n");
            bufferedWriter.write("<section style='padding-bottom:6px;'>\n");
            bufferedWriter.write("<div class='class_article_section_pager_top'></div>\n");
            bufferedWriter.write("</section>\n");
            bufferedWriter.write("<section style='padding-bottom:6px;'>\n");
            bufferedWriter.write("<table class='table class_article_section_table_content'></table>\n");
            bufferedWriter.write("</section>\n");
            bufferedWriter.write("<section style='padding-bottom:6px;'>\n");
            bufferedWriter.write("<div class='class_article_section_pager_bottom'></div>\n");
            bufferedWriter.write("</section>\n");
            bufferedWriter.write("</article>\n");
            bufferedWriter.write("</body>\n");
            bufferedWriter.write("</html>\n");
            System.out.println("write to file success : "+file.getPath());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (bufferedWriter != null) {
                    bufferedWriter.flush();
                    bufferedWriter.close();
                }
                if (outputStream != null) {
                    outputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void writeQueryDiv(BufferedWriter bufferedWriter, IntrospectedTable introspectedTable, String tableName) throws
            IOException {
        bufferedWriter.write("<div class='class_show_hide_button'><span>查询条件 : </span>\n" +
                "<button title='展示查找条件' class='btn class_button_query' style='padding:6px;cursor:pointer' onclick=\"$('.class_query_div').show();\"><image src='" + plusImageSrc + "' /></button>" +
                "<button title='收起查找条件' class='btn class_button_query' style='padding:6px;cursor:pointer' onclick=\"$('.class_query_div').hide();\"><image src='" + minusImageSrc + "' /></button>" +
                "<button title='按照条件查找' class='btn class_button_query' style='padding:6px;cursor:pointer' onclick='queryPage(1)' ><image src='" + searchImageSrc + "' /></button>" +
                "<span style='padding:6px;font-size:12px;'>每页条数：</span><select style='padding:6px;font-size:12px;' class='class_select_limit'><option value='10' selected>10</option><option value='20'>20</option><option value='50'>50</option>" +
                "<option value='100'>100</option></select>" +
                "</div>\n" +
                "<div class='class_query_div' style='display:none'>\n");
        List<IntrospectedColumn> introspectedColumns = introspectedTable.getAllColumns();
        Iterator<IntrospectedColumn> iterator = introspectedColumns.iterator();
        while (iterator.hasNext()) {
            IntrospectedColumn introspectedColumn = iterator.next();
            if (introspectedColumn.isBLOBColumn()) {
            } else {
                FullyQualifiedJavaType fullyQualifiedJavaType = introspectedColumn
                        .getFullyQualifiedJavaType();
                String columnName = introspectedColumn.getJavaProperty();
                if (fullyQualifiedJavaType.isPrimitive()) {
                    if ("boolean".equals(fullyQualifiedJavaType.getFullyQualifiedName())) {
                        bufferedWriter.write("<div style='padding:6px;' class='columnCondition'><span>" + columnName + " = <input type='text' class='class_" + columnName + "' />(类型boolean,填true/false)</span></div>\n");
                    } else if ("byte".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                            || "double".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                            || "float".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                            || "int".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                            || "long".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                            || "short".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                            ) {
                        bufferedWriter.write("<div style='padding:6px;' class='columnCondition'><span>" + columnName + " = <input type='text' class='class_" + columnName + "' />(类型" + fullyQualifiedJavaType.getFullyQualifiedName() + ",填数字)</span></div>\n");
                        bufferedWriter.write("<div style='padding:6px;' class='columnCondition'><span>" + columnName + " 范围查询 : <input type='text' class='class_" + columnName + "_min' /> &lt;= " + columnName + " &lt;=<input type='text' class='class_" + columnName + "_max' /></span></div>\n");
                    } else if ("char".equals(fullyQualifiedJavaType.getFullyQualifiedName())) {
                        bufferedWriter.write("<div style='padding:6px;' class='columnCondition'><span>" + columnName + " = <input type='text' class='class_" + columnName + "' />(查询方式: =" + columnName + ")</span></div>\n");
                    }
                } else if ("java.lang.Boolean".equals(fullyQualifiedJavaType.getFullyQualifiedName())) {
                    bufferedWriter.write("<div style='padding:6px;' class='columnCondition'><span>" + columnName + " : <input type='text' class='class_" + columnName + "' />(类型boolean,填true/false)</span></div>\n");
                } else if ("java.lang.Byte".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                        || "java.lang.Double".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                        || "java.lang.Integer".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                        || "java.lang.Long".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                        || "java.lang.Short".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                        || "java.lang.BigDecimal".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                        ) {
                    bufferedWriter.write("<div style='padding:6px;' class='columnCondition'><span>" + columnName + " = <input type='text' class='class_" + columnName + "' />(类型" + fullyQualifiedJavaType.getFullyQualifiedName() + ",填数字)</span></div>\n");
                    bufferedWriter.write("<div style='padding:6px;' class='columnCondition'><span>" + columnName + " 范围查询 : <input type='text' class='class_" + columnName + "_min' /> &lt;= " + columnName + " &lt;=<input type='text' class='class_" + columnName + "_max' /></span></div>\n");
                } else if ("java.lang.String".equals(fullyQualifiedJavaType.getFullyQualifiedName())) {
                    bufferedWriter.write("<div style='padding:6px;' class='columnCondition'><span>" + columnName + "前缀 : <input type='text' class='class_" + columnName + "_prefix' />(查询方式: like(%" + columnName + "))</span></div>\n");
                    bufferedWriter.write("<div style='padding:6px;' class='columnCondition'><span>" + columnName + "后缀 : <input type='text' class='class_" + columnName + "_suffix' />(查询方式: like(" + columnName + "%))</span></div>\n");
                    bufferedWriter.write("<div style='padding:6px;' class='columnCondition'><span>" + columnName + "通配 : <input type='text' class='class_" + columnName + "_like' />(查询方式: like(%" + columnName + "%))</span></div>\n");
                    bufferedWriter.write("<div style='padding:6px;' class='columnCondition'><span>" + columnName + " = <input type='text' class='class_" + columnName + "' />(查询方式: =" + columnName + ")</span></div>\n");
                } else if ("java.util.Date".equals(fullyQualifiedJavaType.getFullyQualifiedName())) {
                    bufferedWriter.write("<div style='padding:6px;' class='columnCondition'><span>" + columnName + " = <input type='text' class='class_" + columnName + "' />(类型" + fullyQualifiedJavaType.getFullyQualifiedName() + ",填日期时间例如2018/6/6 6:6:6)</span></div>\n");
                    bufferedWriter.write("<div style='padding:6px;' class='columnCondition'><span>" + columnName + " 范围查询 : <input type='text' class='class_" + columnName + "_min' /> &lt;= " + columnName + " &lt;=<input type='text' class='class_" + columnName + "_max' /></span></div>\n");
                } else {
                    bufferedWriter.write("<div style='padding:6px;' class='columnCondition'><span>" + columnName + " = <input type='text' class='class_" + columnName + "' />(查询方式: =" + columnName + ")</span></div>\n");
                }
            }
        }
        bufferedWriter.write("</div>\n");
    }

    public static void writeScriptQueryFunction(BufferedWriter bufferedWriter, IntrospectedTable
            introspectedTable, String tableName) throws IOException {
        List<IntrospectedColumn> introspectedColumns = introspectedTable.getAllColumns();
        bufferedWriter.write("<script type='text/javascript'>\n");
        bufferedWriter.write("var loadingImage = \"<image class='class_loading_image_only' src='" + loadingImageSrc + "'>\";\n");
        bufferedWriter.write("var queryPage=function(page){\n");
        bufferedWriter.write("$('.class_article_section_table_content').html(loadingImage);\n");
        bufferedWriter.write("var limit = $('.class_select_limit').val();\n");
        bufferedWriter.write("var token=localStorage.getItem(\"token\");\n");
        bufferedWriter.write("if(token==undefined || token==\"\"){gotoLoginForContent()}\n");
        bufferedWriter.write("var queryString=\"\";\n");
        bufferedWriter.write(" queryString+=\"page=\"+page+\"&limit=\"+limit;\n");
        Iterator<IntrospectedColumn> iterator = introspectedColumns.iterator();
        boolean isFirstParameter = true;
        while (iterator.hasNext()) {
            IntrospectedColumn introspectedColumn = iterator.next();
            if (introspectedColumn.isBLOBColumn()) {
            } else {
                FullyQualifiedJavaType fullyQualifiedJavaType = introspectedColumn
                        .getFullyQualifiedJavaType();
                String columnName = introspectedColumn.getJavaProperty();
                if (fullyQualifiedJavaType.isPrimitive()) {
                    if ("boolean".equals(fullyQualifiedJavaType.getFullyQualifiedName())) {
                        bufferedWriter.write("if($('.class_" + columnName + "').val()!=undefined && $('.class_" + columnName + "').val()!=''){\nqueryString+='&'+'" + columnName + "='+$('.class_" + columnName + "').val();\n}\n");
                    } else if ("byte".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                            || "double".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                            || "float".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                            || "int".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                            || "long".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                            || "short".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                            ) {
                        bufferedWriter.write("if($('.class_" + columnName + "').val()!=undefined && $('.class_" + columnName + "').val()!=''){\nqueryString+='&'+'" + columnName + "='+$('.class_" + columnName + "').val();\n}\n");
                        bufferedWriter.write("if($('.class_" + columnName + "_max').val()!=undefined && $('.class_" + columnName + "_max').val()!=''){\nqueryString+='&'+'" + columnName + "_max='+$('.class_" + columnName + "_max').val();\n}\n");
                        bufferedWriter.write("if($('.class_" + columnName + "_min').val()!=undefined && $('.class_" + columnName + "_min').val()!=''){\nqueryString+='&'+'" + columnName + "_min='+$('.class_" + columnName + "_min').val();\n}\n");
                        if (isFirstParameter) {
                            isFirstParameter = false;
                        }
                    } else if ("char".equals(fullyQualifiedJavaType.getFullyQualifiedName())) {
                        bufferedWriter.write("if($('.class_" + columnName + "').val()!=undefined && $('.class_" + columnName + "').val()!=''){\nqueryString+='&'+'" + columnName + "='+$('.class_" + columnName + "').val();\n}\n");
                        if (isFirstParameter) {
                            isFirstParameter = false;
                        }
                    }
                } else if ("java.lang.Boolean".equals(fullyQualifiedJavaType.getFullyQualifiedName())) {
                    bufferedWriter.write("if($('.class_" + columnName + "').val()!=undefined && $('.class_" + columnName + "').val()!=''){\nqueryString+='&'+'" + columnName + "='+$('.class_" + columnName + "').val();\n}\n");
                    if (isFirstParameter) {
                        isFirstParameter = false;
                    }
                } else if ("java.lang.Byte".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                        || "java.lang.Double".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                        || "java.lang.Integer".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                        || "java.lang.Long".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                        || "java.lang.Short".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                        || "java.lang.BigDecimal".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                        || "java.util.Date".equals(fullyQualifiedJavaType.getFullyQualifiedName())
                        ) {
                    bufferedWriter.write("if($('.class_" + columnName + "').val()!=undefined && $('.class_" + columnName + "').val()!=''){\nqueryString+='&'+'" + columnName + "='+$('.class_" + columnName + "').val();\n}\n");
                    bufferedWriter.write("if($('.class_" + columnName + "_max').val()!==undefined &&  $('.class_" + columnName + "_max').val()!=''){\nqueryString+='&'+'" + columnName + "_max='+$('.class_" + columnName + "_max').val();\n}\n");
                    bufferedWriter.write("if($('.class_" + columnName + "_min').val()!==undefined &&  $('.class_" + columnName + "_min').val()!=''){\nqueryString+='&'+'" + columnName + "_min='+$('.class_" + columnName + "_min').val();\n}\n");
                } else if ("java.lang.String".equals(fullyQualifiedJavaType.getFullyQualifiedName())) {
                    bufferedWriter.write("if($('.class_" + columnName + "').val()!==undefined &&  $('.class_" + columnName + "').val()!=''){\nqueryString+='&'+'" + columnName + "='+$('.class_" + columnName + "').val();\n}\n");
                    bufferedWriter.write("if($('.class_" + columnName + "_suffix').val()!==undefined &&  $('.class_" + columnName + "_suffix').val()!=''){\nqueryString+='&'+'" + columnName + "_max='+$('.class_" + columnName + "_suffix').val();\n}\n");
                    bufferedWriter.write("if($('.class_" + columnName + "_prefix').val()!==undefined &&  $('.class_" + columnName + "_prefix').val()!=''){\nqueryString+='&'+'" + columnName + "_min='+$('.class_" + columnName + "_prefix').val();\n}\n");
                    bufferedWriter.write("if($('.class_" + columnName + "_like').val()!==undefined &&  $('.class_" + columnName + "_like').val()!=''){\nqueryString+='&'+'" + columnName + "_min='+$('.class_" + columnName + "_like').val();\n}\n");
                }
            }
        }
        bufferedWriter.write("var queryUrl=SERVER_URL+\"/v1/common/" + MybatisUtilCommon.toLowerCaseAtFirstCharacter(tableName) + "/query?\"+queryString;\n");
        bufferedWriter.write("$.ajax({\n");
        bufferedWriter.write("url: queryUrl,\n");
        bufferedWriter.write("type: \"get\",\n");
        bufferedWriter.write("cache: false,\n");
        bufferedWriter.write("async: true,\n");
        bufferedWriter.write("headers: {\"token\": token },\n");
        bufferedWriter.write("contentType: \"application/json\",\n");
        bufferedWriter.write("success: function (res) {\n");
        bufferedWriter.write("if(res.status!=200){\n");
        bufferedWriter.write("validResForContent(res);\n");
        bufferedWriter.write("}else{\n");
        bufferedWriter.write("var list = res.data;\n");
        bufferedWriter.write("var tableString = '';\n");
        bufferedWriter.write("if(list==null){tableString='empty';}else{\n");
        writeScriptTableHead(bufferedWriter, introspectedTable);
        bufferedWriter.write("for(i=0;i<list.length;i++){\n");
        writeScriptTable(bufferedWriter, introspectedTable);
        bufferedWriter.write("}\n");
        bufferedWriter.write("}\n");
        bufferedWriter.write("$('.class_article_section_table_content').html(tableString);\n");
        bufferedWriter.write("var totalPage=res.totalPage;\n");
        bufferedWriter.write("var page=res.page;\n");
        bufferedWriter.write("var pageString=\"<span class='class_span_page' style='padding:6px;border:1px solid #a6a6a6;' onclick='queryPage(1)'>1</span>\";\n");
        bufferedWriter.write("pageString+=\"...\";\n");
        bufferedWriter.write("if(page>=4){pageString+=\"<span class='class_span_page' style='padding:6px;border:1px solid #a6a6a6;' onclick='queryPage(\"+(page-2)+\")'>\"+(page-2)+\"</span>\";}\n");
        bufferedWriter.write("if(page>=3){pageString+=\"<span class='class_span_page' style='padding:6px;border:1px solid #a6a6a6;' onclick='queryPage(\"+(page-1)+\")'>\"+(page-1)+\"</span>\";}\n");
        bufferedWriter.write("if(page>=2 && page<=totalPage-1){pageString+=\"<span class='class_span_page' style='background-color:#a6a6a6;padding:6px;border:1px solid #a6a6a6;' onclick='queryPage(\"+(page)+\")'>\"+(page)+\"</span>\";}\n");
        bufferedWriter.write("if(page<=totalPage-2){pageString+=\"<span class='class_span_page' style='padding:6px;border:1px solid #a6a6a6;' onclick='queryPage(\"+(page+1)+\")'>\"+(page+1)+\"</span>\";}\n");
        bufferedWriter.write("if(page<=totalPage-3){pageString+=\"<span class='class_span_page' style='padding:6px;border:1px solid #a6a6a6;' onclick='queryPage(\"+(page+2)+\")'>\"+(page+2)+\"</span>\";}\n");
        bufferedWriter.write("pageString+=\"...\";\n");
        bufferedWriter.write("pageString+=\"<span class='class_span_page' style='padding:6px;border:1px solid #a6a6a6;' onclick='queryPage(\"+(totalPage)+\")'>\"+(totalPage)+\"</span>\";\n");
        bufferedWriter.write("pageString+=\"&nbsp;页码:<span class='class_span_page' style='padding:6px;border:1px solid #a6a6a6;' >\"+page+\"/\"+totalPage+\"</span>\";\n");
        bufferedWriter.write("$('.class_article_section_pager_top').html(pageString);\n");
        bufferedWriter.write("$('.class_article_section_pager_bottom').html(pageString);\n");
        bufferedWriter.write("}\n");
        bufferedWriter.write("},\n");
        bufferedWriter.write("error: function (message) {\n");
        bufferedWriter.write("$('.class_article_section_table_content').html(message.responseText == undefined ? \"无法连接服务器\" : message.responseText);\n");
        bufferedWriter.write("}\n");
        bufferedWriter.write("});\n");
        bufferedWriter.write("};\n");
        writeScriptForEditLine(bufferedWriter, introspectedTable);
        writeScriptForCancelThisLine(bufferedWriter, introspectedTable);
        writeScriptForConfirmThisLine(bufferedWriter, introspectedTable, tableName);
        writeScriptForAddLine(bufferedWriter, introspectedTable, tableName);
        writeScriptForCloseThisLineDiv(bufferedWriter, introspectedTable, tableName);
        writeScriptForSubmitThisLineDiv(bufferedWriter, introspectedTable, tableName);
        writeScriptForDeleteThisLineDiv(bufferedWriter, introspectedTable, tableName);
        bufferedWriter.write("</script>\n");
    }

    public static Random random = new Random();

    public static String generatePasswordF(int length) {
        String password = "";
        for (int i = 0; i < length; i++) {
            password = password + random.nextInt(10);
        }
        password = password.replace("4", "6").replace("d", "f");
        return password;
    }

    public static String generateToken() {
        String timeStamp = new SimpleDateFormat("yyyyMMddHHmmss").format(Calendar.getInstance().getTime());
        return timeStamp + generatePasswordF(18);
    }


    public static void writeScriptTable(BufferedWriter bufferedWriter, IntrospectedTable introspectedTable) throws
            IOException {
        String tableId = generateToken();
        bufferedWriter.write("tableString+=\"<tr class='class_tr_" + tableId + "_\"+i+\"'>" +
                "<td class='class_td_image_" + tableId + "_\"+i+\"' >" +
                "<image src='" + loadingImageSrc + "'            class='class_image_loading_" + tableId + "_\"+i+\"' style='display:none;' />" +
                "</td><td>" +
                "<image src='" + editImageSrc + "'" +
                " class='class_image_edit_" + tableId + "_\"+i+\"'   onclick=\\\"editThisLine('" + tableId + "_\"+i+\"')\\\" style='cursor:pointer'/>" +
                "</td><td>" +
                "<image src='" + yesImageSrc + "'" +
                " class='class_image_confirm_" + tableId + "_\"+i+\"'  onclick=\\\"confirmThisLine('" + tableId + "_\"+i+\"')\\\" style='cursor:pointer;display:none;' />" +
                "</td><td>" +
                "<image src='" + noImageSrc + "'  " +
                "class='class_image_cancel_" + tableId + "_\"+i+\"' onclick=\\\"cancelThisLine('" + tableId + "_\"+i+\"')\\\" style='cursor:pointer;display:none;' />" +
                "</td><td><image src='" + deleteImageSrc + "' " +
                " class='class_image_delete_" + tableId + "_\"+i+\"' onclick=\\\"deleteThisLine('" + tableId + "_\"+i+\"')\\\" style='cursor:pointer'  />" +
                "</td>\";\n");
        List<IntrospectedColumn> introspectedColumns = introspectedTable.getAllColumns();
        List<IntrospectedColumn> introspectedColumnsPrimaryKey = introspectedTable.getPrimaryKeyColumns();
        Iterator<IntrospectedColumn> iterator = introspectedColumns.iterator();
        while (iterator.hasNext()) {
            IntrospectedColumn introspectedColumn = iterator.next();
            FullyQualifiedJavaType fullyQualifiedJavaType = introspectedColumn
                    .getFullyQualifiedJavaType();
            String columnName = introspectedColumn.getJavaProperty();
            bufferedWriter.write("tableString+= \"<td class='class_td_" + tableId + "_\"+i+\"'>" +
                    "<span class='class_text_" + tableId + "_\"+i+\" class_text_" + tableId + "_\"+i+\"_" + columnName + "' columnName='" + columnName + "' >\"+" +
                    ("java.util.Date".equals(fullyQualifiedJavaType.getFullyQualifiedName()) ?
                            "timestampToTime(list[i]." + columnName + ")" :
                            "list[i]." + columnName
                    ) +
                    "+\"</span>" +
                    "<input " +
                    "" + (introspectedColumnsPrimaryKey.contains(introspectedColumn) ? "disabled" : "") + " " +
                    "class='class_input_" + tableId + "_\"+i+\" class_input_" + tableId + "_\"+i+\"_" + columnName + "' columnName='" + columnName + "' " +
                    "style='font-size:12px; display:none' value='\"+list[i]." + columnName + "+\"'" +
                    "><image style='cursor:pointer; display:none' class='class_image_showSelectBox_" + tableId + "_\"+i+\"' src='" + editImageSrc + "' onclick=\\\"showSelectBox('" + tableId + "','" + columnName + "')\\\" />" +
                    "</td>\";\n");
        }
        bufferedWriter.write("tableString+='</tr>';\n");
    }

    private static void writeScriptTableHead(BufferedWriter bufferedWriter, IntrospectedTable introspectedTable) throws
            IOException {
        List<IntrospectedColumn> introspectedColumns = introspectedTable.getAllColumns();
        Iterator<IntrospectedColumn> iterator = introspectedColumns.iterator();
        bufferedWriter.write("tableString+=\"<tr><th style='width:26px;'>加载</th><th style='width:26px;'>编辑</th><th style='width:26px;'>确认</th><th style='width:26px;'>取消</th><th style='width:26px;'>删除</th>\";\n");
        while (iterator.hasNext()) {
            IntrospectedColumn introspectedColumn = iterator.next();
            FullyQualifiedJavaType fullyQualifiedJavaType = introspectedColumn
                    .getFullyQualifiedJavaType();
            String columnName = introspectedColumn.getJavaProperty();
            bufferedWriter.write("tableString+= \"<th>" + columnName + "</th>\";\n");
        }
        bufferedWriter.write("tableString+='</tr>';\n");
    }

    private static void writeScriptForEditLine(BufferedWriter bufferedWriter, IntrospectedTable introspectedTable) throws
            IOException {
        bufferedWriter.write("var editThisLine = function(tableId){");
        bufferedWriter.write("$(\".class_text_\"+tableId).hide();\n");
        bufferedWriter.write("$(\".class_image_edit_\"+tableId).hide();\n");
        bufferedWriter.write("$(\".class_image_cancel_\"+tableId).show();\n");
        bufferedWriter.write("$(\".class_image_confirm_\"+tableId).show();\n");
        bufferedWriter.write("$(\".class_input_\"+tableId).show();\n");
        bufferedWriter.write("$(\".class_image_showSelectBox_\"+tableId).show();\n");
        bufferedWriter.write("}\n");
    }

    private static void writeScriptForCancelThisLine(BufferedWriter bufferedWriter, IntrospectedTable
            introspectedTable) throws IOException {
        bufferedWriter.write("var cancelThisLine = function(tableId){");
        bufferedWriter.write("$(\".class_text_\"+tableId).show();\n");
        bufferedWriter.write("$(\".class_image_edit_\"+tableId).show();\n");
        bufferedWriter.write("$(\".class_input_\"+tableId).hide();\n");
        bufferedWriter.write("$(\".class_image_cancel_\"+tableId).hide();\n");
        bufferedWriter.write("$(\".class_image_confirm_\"+tableId).hide();\n");
        bufferedWriter.write("$(\".class_image_showSelectBox_\"+tableId).hide();\n");
        List<IntrospectedColumn> introspectedColumns = introspectedTable.getAllColumns();
        List<IntrospectedColumn> introspectedColumnsPrimaryKey = introspectedTable.getPrimaryKeyColumns();
        Iterator<IntrospectedColumn> iterator = introspectedColumns.iterator();
        while (iterator.hasNext()) {
            IntrospectedColumn introspectedColumn = iterator.next();
            String columnName = introspectedColumn.getJavaProperty();
            bufferedWriter.write("$(\".class_input_\"+tableId+\"_" + columnName + "\").val($(\".class_text_\"+tableId+\"_" + columnName + "\").html());\n");
        }
        bufferedWriter.write("}\n");
    }


    private static void writeScriptForConfirmThisLine(BufferedWriter bufferedWriter, IntrospectedTable
            introspectedTable, String tableName) throws IOException {
        bufferedWriter.write("var confirmThisLine = function(tableId){");
        bufferedWriter.write("$(\".class_image_loading_\"+tableId).show();\n");
        bufferedWriter.write("$(\".class_input_\"+tableId).attr('disabled','disabled');\n");
        bufferedWriter.write("var queryUrl=SERVER_URL+\"/v1/common/" + MybatisUtilCommon.toLowerCaseAtFirstCharacter(tableName) + "/update\";\n");
        bufferedWriter.write("var token=localStorage.getItem(\"token\");\n");
        bufferedWriter.write("$.ajax({\n");
        bufferedWriter.write("url: queryUrl,\n");
        bufferedWriter.write("type: \"post\",\n");
        bufferedWriter.write("cache: false,\n");
        bufferedWriter.write("async: true,\n");
        bufferedWriter.write("headers: {\"token\": token },\n");
        bufferedWriter.write("contentType: \"application/json\",\n");
        bufferedWriter.write("data: JSON.stringify({\n");
        List<IntrospectedColumn> introspectedColumns = introspectedTable.getAllColumns();
        List<IntrospectedColumn> introspectedColumnsPrimaryKey = introspectedTable.getPrimaryKeyColumns();
        Iterator<IntrospectedColumn> iterator = introspectedColumns.iterator();
        Integer columnCount = 0;
        while (iterator.hasNext()) {
            IntrospectedColumn introspectedColumn = iterator.next();
            String columnName = introspectedColumn.getJavaProperty();
            bufferedWriter.write("\"" + columnName + "\": $(\".class_input_\" + tableId + \"_" + columnName + "\").val(),\n");
            columnCount += 1;
        }
        bufferedWriter.write("}),\n");
        bufferedWriter.write("success: function (res) {\n");
        bufferedWriter.write("$(\".class_image_loading_\"+tableId).hide();\n");
        bufferedWriter.write("$(\".class_input_\"+tableId).removeAttr('disabled');\n");
        bufferedWriter.write("if(res.status!=200){\n");
        bufferedWriter.write("validResForContent(res);\n");
        bufferedWriter.write("}else{\n");
        introspectedColumns = introspectedTable.getAllColumns();
        iterator = introspectedColumns.iterator();
        while (iterator.hasNext()) {
            IntrospectedColumn introspectedColumn = iterator.next();
            String columnName = introspectedColumn.getJavaProperty();
            bufferedWriter.write("$(\".class_text_\"+tableId+\"_" + columnName + "\").html($(\".class_input_\"+tableId+\"_" + columnName + "\").val());\n");
        }
        bufferedWriter.write("$(\".class_input_\"+tableId).hide();\n");
        bufferedWriter.write("$(\".class_text_\"+tableId).show();\n");
        bufferedWriter.write("$(\".class_image_edit_\"+tableId).show();\n");
        bufferedWriter.write("$(\".class_image_cancel_\"+tableId).hide();\n");
        bufferedWriter.write("$(\".class_image_confirm_\"+tableId).hide();\n");
        bufferedWriter.write("$(\".class_image_showSelectBox_\"+tableId).hide();\n");
        bufferedWriter.write("}\n");
        bufferedWriter.write("}\n");
        bufferedWriter.write("});\n");
        bufferedWriter.write("}\n");
    }

    private static void writeScriptForAddLine(BufferedWriter bufferedWriter, IntrospectedTable
            introspectedTable, String tableName) throws IOException {
        bufferedWriter.write("var addLine =function(){\n");
        bufferedWriter.write("$(\".class_div_add_line\").show();\n");
        bufferedWriter.write("}\n");
    }

    private static void writeScriptForCloseThisLineDiv(BufferedWriter bufferedWriter, IntrospectedTable
            introspectedTable, String tableName) throws IOException {
        bufferedWriter.write("var closeThisLineDiv =function(){\n");
        Boolean hasBlob = false;
        List<IntrospectedColumn> introspectedColumns = introspectedTable.getAllColumns();
        //List<IntrospectedColumn> introspectedColumnsPrimaryKey = introspectedTable.getPrimaryKeyColumns();
        Iterator<IntrospectedColumn> iterator = introspectedColumns.iterator();
        while (iterator.hasNext()) {
            IntrospectedColumn introspectedColumn = iterator.next();
            String columnName = introspectedColumn.getJavaProperty();
            if(introspectedColumn.getLength()> MybatisUtilCommon.COLUMN_FIELD_LENGTH || introspectedColumn.isBLOBColumn()) {
                hasBlob = true;
            }
        }
        if(hasBlob==true){
            bufferedWriter.write("location.href=location.href.split('#')[0];\n");
        }else {
            bufferedWriter.write("$(\".class_div_add_line\").hide();\n");
        }
        bufferedWriter.write("}\n");
    }

    private static void writeScriptForSubmitThisLineDiv(BufferedWriter bufferedWriter, IntrospectedTable
            introspectedTable, String tableName) throws IOException {
        bufferedWriter.write("var submitThisLineDiv = function(){\n");
        bufferedWriter.write("$(\".class_div_add_line_button\").append(loadingImage);\n");
        bufferedWriter.write("$('.class_input_add_line_column').attr('disabled','disabled');\n");
        bufferedWriter.write("var queryUrl=SERVER_URL+\"/v1/common/" + MybatisUtilCommon.toLowerCaseAtFirstCharacter(tableName) + "/add\";\n");
        bufferedWriter.write("var token=localStorage.getItem(\"token\");\n");
        bufferedWriter.write("$.ajax({\n");
        bufferedWriter.write("url: queryUrl,\n");
        bufferedWriter.write("type: \"post\",\n");
        bufferedWriter.write("cache: false,\n");
        bufferedWriter.write("async: true,\n");
        bufferedWriter.write("headers: {\"token\": token },\n");
        bufferedWriter.write("contentType: \"application/json\",\n");
        bufferedWriter.write("data: JSON.stringify({\n");
        List<IntrospectedColumn> introspectedColumns = introspectedTable.getAllColumns();
        List<IntrospectedColumn> introspectedColumnsPrimaryKey = introspectedTable.getPrimaryKeyColumns();
        Iterator<IntrospectedColumn> iterator = introspectedColumns.iterator();
        while (iterator.hasNext()) {
            IntrospectedColumn introspectedColumn = iterator.next();
            String columnName = introspectedColumn.getJavaProperty();
            if(introspectedColumn.getLength()> MybatisUtilCommon.COLUMN_FIELD_LENGTH || introspectedColumn.isBLOBColumn()) {
                bufferedWriter.write("\"" + columnName + "\": $(\".class_input_add_line_" + columnName + "\").html()==\"\"?null:$(\".class_input_add_line_" + columnName + "\").html(),\n");
            }else{
                bufferedWriter.write("\"" + columnName + "\": $(\".class_input_add_line_" + columnName + "\").val()==\"\"?null:$(\".class_input_add_line_" + columnName + "\").val(),\n");
            }
        }
        bufferedWriter.write("}),\n");
        bufferedWriter.write("success: function (res) {\n");
        bufferedWriter.write("$(\".class_div_add_line_button\").find('.class_loading_image_only').remove();\n");
        bufferedWriter.write("$(\".class_input_add_line_column\").removeAttr('disabled');\n");
        bufferedWriter.write("if(res.status!=200){\n");
        bufferedWriter.write("validResForContent(res);\n");
        bufferedWriter.write("}else{\n");
        bufferedWriter.write("$(\".class_div_add_line\").hide();\n" /*+
                "$(\".class_input_add_line_column\").val(\"\");\n"*/);
        bufferedWriter.write("alert(res.message);\n");
        bufferedWriter.write("}\n");
        bufferedWriter.write("}\n");
        bufferedWriter.write("});\n");
        bufferedWriter.write("}\n");
    }

    private static void writeScriptForDeleteThisLineDiv(BufferedWriter bufferedWriter, IntrospectedTable
            introspectedTable, String tableName) throws IOException {
        bufferedWriter.write("var deleteThisLine = function(tableId){");
        bufferedWriter.write("$(\".class_image_loading_\"+tableId).show();\n");
        bufferedWriter.write("$(\".class_input_\"+tableId).attr('disabled','disabled');\n");
        bufferedWriter.write("var queryUrl=SERVER_URL+\"/v1/common/" + MybatisUtilCommon.toLowerCaseAtFirstCharacter(tableName) + "/delete");
        List<IntrospectedColumn> introspectedColumnsPrimaryKey = introspectedTable.getPrimaryKeyColumns();
        Iterator<IntrospectedColumn> iteratorPrimaryKey = introspectedColumnsPrimaryKey.iterator();
        while (iteratorPrimaryKey.hasNext()) {
            IntrospectedColumn introspectedColumn = iteratorPrimaryKey.next();
            String columnName = introspectedColumn.getJavaProperty();
            if (introspectedColumn.isBLOBColumn()) {
            } else {
                bufferedWriter.write("/\"+$(\".class_text_\"+tableId+\"_" + columnName + "\").html()+\"");
            }
        }
        bufferedWriter.write("\";\n");
        bufferedWriter.write("var token=localStorage.getItem(\"token\");\n");
        bufferedWriter.write("$.ajax({\n");
        bufferedWriter.write("url: queryUrl,\n");
        bufferedWriter.write("type: \"get\",\n");
        bufferedWriter.write("cache: false,\n");
        bufferedWriter.write("async: true,\n");
        bufferedWriter.write("headers: {\"token\": token },\n");
        bufferedWriter.write("contentType: \"application/json\",\n");
        List<IntrospectedColumn> introspectedColumns = introspectedTable.getPrimaryKeyColumns();
        Iterator<IntrospectedColumn> iterator = introspectedColumns.iterator();
        bufferedWriter.write("success: function (res) {\n");
        bufferedWriter.write("$(\".class_image_loading_\"+tableId).hide();\n");
        bufferedWriter.write("$(\".class_input_\"+tableId).removeAttr('disabled');\n");
        bufferedWriter.write("if(res.status!=200){\n");
        bufferedWriter.write("validResForContent(res);\n");
        bufferedWriter.write("}else{\n");
        bufferedWriter.write("$('.class_tr_'+tableId).remove();");
        bufferedWriter.write("}\n");
        bufferedWriter.write("}\n");
        bufferedWriter.write("});\n");
        bufferedWriter.write("}\n");
    }

    public static void writeLoginPage(IntrospectedTable introspectedTable, String htmlPath, String modelUrl, String
            loginUrl) {
        File file = null;
        OutputStream fileOutputStream = null;
        BufferedWriter bufferedWriter = null;
        try {
            File folder = new File(htmlPath + "");
            folder.mkdirs();
            file = new File(htmlPath + "/login.html");
            //如果文件不存在，则创建文件
            file.createNewFile();
            fileOutputStream = new FileOutputStream(file);
            bufferedWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream, "utf-8"));
            String table = introspectedTable.getBaseRecordType();
            String tableName = table.replaceAll(modelUrl + ".", "");
            bufferedWriter.write("\n");
            bufferedWriter.write("<!DOCTYPE html>\n");
            bufferedWriter.write("<html>\n");
            bufferedWriter.write("<head>\n");
            bufferedWriter.write("<meta charset=\"UTF-8\">\n");
            bufferedWriter.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n");
            bufferedWriter.write("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\">\n");
            bufferedWriter.write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no\">\n");
            bufferedWriter.write("<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\">\n");
            bufferedWriter.write("<meta name=\"referrer\" content=\"always\">\n");
            bufferedWriter.write("<meta http-equiv=\"Cache-Control\" content=\"max-age=31536000\" />\n");
            bufferedWriter.write("<title>login</title>\n");
            bufferedWriter.write("<style>\n");
            bufferedWriter.write("html, body {height: 100%;}body {font: 12px 'Lucida Sans Unicode', 'Trebuchet MS', Arial, Helvetica;margin: 0;background-color: #d9dee2;background-image: -webkit-gradient(linear, left top, left bottom, from(#ebeef2), to(#d9dee2));background-image: -webkit-linear-gradient(top, #ebeef2, #d9dee2);background-image: -moz-linear-gradient(top, #ebeef2, #d9dee2);background-image: -ms-linear-gradient(top, #ebeef2, #d9dee2);background-image: -o-linear-gradient(top, #ebeef2, #d9dee2);background-image: linear-gradient(top, #ebeef2, #d9dee2);}#login {background-color: #fff;background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));background-image: -webkit-linear-gradient(top, #fff, #eee);background-image: -moz-linear-gradient(top, #fff, #eee);background-image: -ms-linear-gradient(top, #fff, #eee);background-image: -o-linear-gradient(top, #fff, #eee);background-image: linear-gradient(top, #fff, #eee);height: 240px;width: 400px;margin: -150px 0 0 -230px;padding: 30px;position: absolute;top: 50%;left: 50%;z-index: 0;-moz-border-radius: 3px;-webkit-border-radius: 3px;border-radius: 3px;-webkit-box-shadow: 0 0 2px rgba(0, 0, 0, 0.2),0 1px 1px rgba(0, 0, 0, .2),0 3px 0 #fff,0 4px 0 rgba(0, 0, 0, .2),0 6px 0 #fff,0 7px 0 rgba(0, 0, 0, .2);-moz-box-shadow: 0 0 2px rgba(0, 0, 0, 0.2),1px 1px 0 rgba(0, 0, 0, .1),3px 3px 0 rgba(255, 255, 255, 1),4px 4px 0 rgba(0, 0, 0, .1),6px 6px 0 rgba(255, 255, 255, 1),7px 7px 0 rgba(0, 0, 0, .1);box-shadow: 0 0 2px rgba(0, 0, 0, 0.2),0 1px 1px rgba(0, 0, 0, .2),0 3px 0 #fff,0 4px 0 rgba(0, 0, 0, .2),0 6px 0 #fff,0 7px 0 rgba(0, 0, 0, .2);}#login:before {content: '';position: absolute;z-index: -1;border: 1px dashed #ccc;top: 5px;bottom: 5px;left: 5px;right: 5px;-moz-box-shadow: 0 0 0 1px #fff;-webkit-box-shadow: 0 0 0 1px #fff;box-shadow: 0 0 0 1px #fff;}h1 {text-shadow: 0 1px 0 rgba(255, 255, 255, .7), 0px 2px 0 rgba(0, 0, 0, .5);text-transform: uppercase;text-align: center;color: #666;margin: 0 0 30px 0;letter-spacing: 4px;font: normal 26px/1 Verdana, Helvetica;position: relative;}h1:after, h1:before {background-color: #777;content: \"\";height: 1px;position: absolute;top: 15px;width: 120px;}h1:after {background-image: -webkit-gradient(linear, left top, right top, from(#777), to(#fff));background-image: -webkit-linear-gradient(left, #777, #fff);background-image: -moz-linear-gradient(left, #777, #fff);background-image: -ms-linear-gradient(left, #777, #fff);background-image: -o-linear-gradient(left, #777, #fff);background-image: linear-gradient(left, #777, #fff);right: 0;}h1:before {background-image: -webkit-gradient(linear, right top, left top, from(#777), to(#fff));background-image: -webkit-linear-gradient(right, #777, #fff);background-image: -moz-linear-gradient(right, #777, #fff);background-image: -ms-linear-gradient(right, #777, #fff);background-image: -o-linear-gradient(right, #777, #fff);background-image: linear-gradient(right, #777, #fff);left: 0;}fieldset {border: 0;padding: 0;margin: 0;}#inputs input {/*background: #f1f1f1 url(images/login-sprite.png) no-repeat;*/padding: 15px 15px 15px 30px;margin: 0 0 10px 0;width: 353px; /* 353 + 2 + 45 = 400 */border: 1px solid #ccc;-moz-border-radius: 5px;-webkit-border-radius: 5px;border-radius: 5px;-moz-box-shadow: 0 1px 1px #ccc inset, 0 1px 0 #fff;-webkit-box-shadow: 0 1px 1px #ccc inset, 0 1px 0 #fff;box-shadow: 0 1px 1px #ccc inset, 0 1px 0 #fff;}#username {background-position: 5px -2px !important;}#password {background-position: 5px -52px !important;}#inputs input:focus {background-color: #fff;border-color: #e8c291;outline: none;-moz-box-shadow: 0 0 0 1px #e8c291 inset;-webkit-box-shadow: 0 0 0 1px #e8c291 inset;box-shadow: 0 0 0 1px #e8c291 inset;}#actions {margin: 25px 0 0 0;}#submit {background-color: #ffb94b;background-image: -webkit-gradient(linear, left top, left bottom, from(#fddb6f), to(#ffb94b));background-image: -webkit-linear-gradient(top, #fddb6f, #ffb94b);background-image: -moz-linear-gradient(top, #fddb6f, #ffb94b);background-image: -ms-linear-gradient(top, #fddb6f, #ffb94b);background-image: -o-linear-gradient(top, #fddb6f, #ffb94b);background-image: linear-gradient(top, #fddb6f, #ffb94b);-moz-border-radius: 3px;-webkit-border-radius: 3px;border-radius: 3px;text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);-moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;-webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;border-width: 1px;border-style: solid;border-color: #d69e31 #e3a037 #d5982d #e3a037;float: left;height: 35px;padding: 0;width: 120px;cursor: pointer;font: bold 15px Arial, Helvetica;color: #8f5a0a;}#submit:hover, #submit:focus {background-color: #fddb6f;background-image: -webkit-gradient(linear, left top, left bottom, from(#ffb94b), to(#fddb6f));background-image: -webkit-linear-gradient(top, #ffb94b, #fddb6f);background-image: -moz-linear-gradient(top, #ffb94b, #fddb6f);background-image: -ms-linear-gradient(top, #ffb94b, #fddb6f);background-image: -o-linear-gradient(top, #ffb94b, #fddb6f);background-image: linear-gradient(top, #ffb94b, #fddb6f);}#submit:active {outline: none;-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;}#submit::-moz-focus-inner {border: none;}#actions a {color: #3151A2;float: right;line-height: 35px;margin-left: 10px;}#back {display: block;text-align: center;position: relative;top: 60px;color: #999;}\n");
            bufferedWriter.write("</style>\n");
            bufferedWriter.write("<script src=\"js/common/jquery.js\" type=\"text/javascript\"></script>\n");
            bufferedWriter.write("<script src=\"js/common/md5.js\" type=\"text/javascript\"></script>\n");
            bufferedWriter.write("<script src=\"js/common/server.js\" type=\"text/javascript\"></script>\n");
            bufferedWriter.write("<script>\n");
            bufferedWriter.write("$(function () {\n");
            bufferedWriter.write("var username = localStorage.getItem(\"username\");\n");
            bufferedWriter.write("if (username != undefined) {\n");
            bufferedWriter.write("$('.class_username').val(username);\n");
            bufferedWriter.write("}\n");
            bufferedWriter.write("})\n");
            bufferedWriter.write("var login = function () {\n" +
                    "            if($(\".class_username\").val()==\"\"){\n" +
                    "                return;\n" +
                    "            }\n" +
                    "            if($(\".class_password\").val()==\"\"){\n" +
                    "                return;\n" +
                    "            }\n");
            bufferedWriter.write("var username= $(\".class_username\").val();");
            bufferedWriter.write("var password= md5($(\".class_password\").val());");
            bufferedWriter.write("var loginUrl = \"" + loginUrl + "?username=\"+username+\"&password=\"+password;\n");
            bufferedWriter.write("localStorage.setItem(\"username\", $('.class_username').val());\n");
            bufferedWriter.write("$.ajax({\n");
            bufferedWriter.write("url: loginUrl,\n");
            bufferedWriter.write("type: \"get\",\n");
            bufferedWriter.write("cache: false,\n");
            bufferedWriter.write("async: true,\n");
            bufferedWriter.write("contentType: \"application/json\",\n");
            bufferedWriter.write("success: function (res) {\n");
            bufferedWriter.write("if(res.status==200){\n");
            bufferedWriter.write("if(res.data.token!=undefined){\n");
            bufferedWriter.write("localStorage.setItem(\"token\",res.data.token);\n");
            bufferedWriter.write("localStorage.setItem(\"userId\",res.data.userId);\n");
            bufferedWriter.write("localStorage.setItem(\"username\",res.data.username);\n");
            bufferedWriter.write("}else{\n");
            bufferedWriter.write("localStorage.setItem(\"token\",res.data);\n");
            bufferedWriter.write("}\n");
            bufferedWriter.write("var top1=top;\n" +
                    "if(top !=undefined){top1.location.href='index.html';}else{" +
                    "location.href=\"index.html\";}\n");
            bufferedWriter.write("}else{\n");
            bufferedWriter.write("validResForIndex(res);\n");
            bufferedWriter.write("}\n");
            bufferedWriter.write("},\n");
            bufferedWriter.write("error: function (message) {\n");
            bufferedWriter.write("alert(message.responseText == undefined ? \"无法连接服务器\" : message.responseText);\n");
            bufferedWriter.write("}\n");
            bufferedWriter.write("});\n");
            bufferedWriter.write("}\n");
            bufferedWriter.write("</script>\n");
            bufferedWriter.write("</head>\n");
            bufferedWriter.write("<body>\n");
            bufferedWriter.write("<div id=\"login\">\n");
            bufferedWriter.write("<h1>后台登陆</h1>\n");
            bufferedWriter.write("<fieldset id=\"inputs\">\n");
            bufferedWriter.write("<input class=\"class_username\" type=\"text\" placeholder=\"Username\" autofocus required>\n");
            bufferedWriter.write("<image src=\"\" /><input class=\"class_password\" type=\"password\" placeholder=\"Password\" required>\n");
            bufferedWriter.write("</fieldset>\n");
            bufferedWriter.write("<fieldset id=\"actions\">\n");
            bufferedWriter.write("<input type=\"button\" onclick=\"login()\" id=\"submit\" value=\"Log in\">\n");
            bufferedWriter.write("</fieldset>\n");
            bufferedWriter.write("</div>\n");
            bufferedWriter.write("<br><br>\n");
            bufferedWriter.write("<div style=\"text-align:center;clear:both\">\n");
            bufferedWriter.write("</div>\n");
            bufferedWriter.write("</body>\n");
            bufferedWriter.write("</html>\n");
            System.out.println("write to file success : "+file.getPath());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (bufferedWriter != null) {
                    bufferedWriter.flush();
                    bufferedWriter.close();
                }
                if (fileOutputStream != null) {
                    fileOutputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void writeTopPage(IntrospectedTable introspectedTable, String htmlPath, String modelUrl) {
        File file = null;
        OutputStream fileOutputStream = null;
        BufferedWriter bufferedWriter = null;
        try {
            File folder = new File(htmlPath + "");
            folder.mkdirs();
            file = new File(htmlPath + "/top.html");
            file.createNewFile();
            fileOutputStream = new FileOutputStream(file);
            bufferedWriter = new BufferedWriter(new OutputStreamWriter(fileOutputStream, "utf-8"));
            String table = introspectedTable.getBaseRecordType();
            //String tableName = table.replaceAll(modelUrl + ".", "");
            bufferedWriter.write("<a class='navigate' style=' padding:6px;text-decoration: none; font-size:  12px; margin-left:12px;' href='index.html'>首页</a>" +
                    "<span class='userInfo'><span class='navigate' style=' padding:6px;text-decoration: none; font-size:  12px; margin-left:12px;'  " +
                    "onclick=\"$('.class_section_iframe').attr('src','login.html');\" " +
                    "href='javascript:void(0)'>登录</span></span>" +
                    "<script>\n" +
                    "    $(function () {\n" +
                    "        setUserInfo();" +
                    "    });\n" +
                    "    var setUserInfo = function () {\n" +
                    "        var username = localStorage.getItem(\"username\");\n" +
                    "        if (username != undefined) {\n" +
                    "            $(\".userInfo\").html(\"<span class='navigate' style=' padding:6px;text-decoration: none; font-size:  12px; margin-left:12px;' >\" + username + \"</span><span class='navigate' style=' padding:6px;text-decoration: none; font-size:  12px; margin-left:12px;' onclick='logout();'>登出</span>\");\n" +
                    "        }\n" +
                    "    }\n" +
                    "    var logout = function () {\n" +
                    "        localStorage.removeItem(\"userId\");\n" +
                    "        localStorage.removeItem(\"username\");\n" +
                    "        localStorage.removeItem(\"token\");\n" +
                    "        gotoLoginForIndex();\n" +
                    "    }\n" +
                    "</script>" +
                    "\n");
            System.out.println("write to file success : "+file.getPath());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (bufferedWriter != null) {
                    bufferedWriter.flush();
                    bufferedWriter.close();
                }
                if (fileOutputStream != null) {
                    fileOutputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }

    public static String getProperCase(String s) {
        return s.substring(0, 1).toUpperCase() + s.substring(1);
    }

}
